* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #ffffff;
  color: #2b2b2b;
  font-family: "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Loading Skeleton Screen */
.loading-skeleton-screen {
  width: 100%;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: #ffffff;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 24px;
}

.loading-skeleton-screen.hidden {
  display: none;
}

.skeleton-layout {
  width: 800px;
  max-width: 100%;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.skeleton-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 16px;
}

.skeleton-title {
  width: 200px;
  height: 40px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: 8px;
  animation: shimmer 1.5s infinite;
}

.skeleton-button {
  width: 140px;
  height: 36px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: 8px;
  animation: shimmer 1.5s infinite;
}

.skeleton-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.skeleton-card {
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.skeleton-icon {
  width: 48px;
  height: 48px;
  border-radius: 73px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  flex-shrink: 0;
  animation: shimmer 1.5s infinite;
}

.skeleton-text-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.skeleton-text-line {
  height: 20px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.5s infinite;
}

.skeleton-text-line-title {
  width: 60%;
  height: 24px;
}

.skeleton-text-line-description {
  width: 80%;
  height: 16px;
}

.skeleton-check {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  flex-shrink: 0;
  animation: shimmer 1.5s infinite;
}

.skeleton-grid {
  width: 100%;
  height: 120px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.empty-state {
  width: 100%;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: #ffffff;
  opacity: 0;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

/* Show empty state when not hidden (after initApp determines it should be visible) */
.empty-state:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.empty-state.hidden {
  opacity: 0;
  transform: translateX(-30px);
  pointer-events: none;
}

.main-container {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 600px;
  padding: 20px;
}

.illustration-container {
  height: 240px;
  position: relative;
  width: 480px;
  max-width: 100%;
  flex-shrink: 0;
}

.illustration-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  pointer-events: none;
  max-width: none;
}

.text-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  width: 100%;
}

.heading {
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 20px;
  color: #2b2b2b;
  margin: 0;
}

.description {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  color: #555555;
  margin: 0;
}

.add-button {
  background: #226ff1;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px 20px 8px 16px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.2s;
}

.add-button:hover {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.1) 100%),
    linear-gradient(90deg, rgb(34, 111, 241) 0%, rgb(34, 111, 241) 100%);
  box-shadow: none;
}

.add-button:active {
  transform: translateY(0);
}

.plus-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block;
}

.button-text {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #ffffff;
  white-space: nowrap;
}

/* New Habit Form Styles */
.new-habit-screen {
  width: 100%;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: #ffffff;
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

.new-habit-screen.hidden {
  opacity: 0;
  transform: translateX(30px);
  pointer-events: none;
}

.new-habit-screen:not(.hidden) {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.add-layout {
  width: 800px;
  max-width: 100%;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 100px;
  box-sizing: border-box;
}

.new-habit-content {
  display: flex;
  flex-direction: column;
  gap: 32px;
  align-items: flex-start;
  width: 100%;
}

.header-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  width: 100%;
}

.icon-header {
  background: #fee2e2;
  height: 155px;
  border-radius: 6px;
  width: 100%;
  position: relative;
  overflow: visible;
  transition: background-color 240ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.icon-circle {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #f9736f;
  border-radius: 73px;
  width: 48px;
  height: 48px;
  overflow: visible;
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
  cursor: pointer;
  z-index: 1001;
}

.icon-circle.pop {
  animation: iconPop 180ms ease;
}

@keyframes iconPop {
  0% {
    transform: translate(-50%, -50%) scale(0.96);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.04);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

.icon-inner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-inner svg {
  width: 100%;
  height: 100%;
}

.hero-icon {
  color: #ffffff;
}

/* Icon Circle Active State - when picker is open */
.icon-header.picker-open .icon-circle {
  box-shadow: 
    0 0 0 2px var(--icon-circle-shadow-color, rgba(249, 115, 111, 0.50)),
    0 2px 8px rgba(0, 0, 0, 0.12),
    0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Icon Picker Popover */
.icon-picker-popover {
  position: absolute;
  top: calc(50% + 28px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
}

.icon-picker-popover.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-4px);
}

.icon-picker-content {
  background: #ffffff;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  padding: 7px;
  width: 318px;
  max-height: 240px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: relative;
}

.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0;
  overflow-y: auto;
  max-height: 226px;
  padding: 0;
  width: 304px;
}

.icon-picker-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 0;
}

.icon-option {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  color: #555555;
  border-radius: 4px;
  flex-shrink: 0;
}

.icon-option:hover {
  background-color: #f5f5f5;
}

.icon-option svg {
  width: 24px;
  height: 24px;
  color: inherit;
}

/* Custom scrollbar styling */
.icon-picker-grid::-webkit-scrollbar {
  width: 4px;
}

.icon-picker-grid::-webkit-scrollbar-track {
  background: transparent;
}

.icon-picker-grid::-webkit-scrollbar-thumb {
  background: #bfbfbf;
  border-radius: 41px;
}

.icon-picker-grid::-webkit-scrollbar-thumb:hover {
  background: #959595;
}

.color-palette {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.2s;
  border: 1px solid transparent;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  border: none;
  transition: border 140ms ease, box-shadow 140ms ease;
}

.color-swatch-inner {
  position: absolute;
  inset: 0;
  background: #f9736f;
  border-radius: 6px;
}

.color-swatch-check {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 4px;
  display: none;
  opacity: 0;
  transition: opacity 140ms ease;
}

.color-swatch.selected .color-swatch-check {
  display: block;
  opacity: 1;
  animation: checkFadeIn 140ms ease;
}

@keyframes checkFadeIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Set background colors for each swatch */
.color-swatch[data-color="#f9736f"] {
  background: #f9736f;
}
.color-swatch[data-color="#fb933c"] {
  background: #fb933c;
}
.color-swatch[data-color="#fbbf23"] {
  background: #fbbf23;
}
.color-swatch[data-color="#facc14"] {
  background: #facc14;
}
.color-swatch[data-color="#a3e634"] {
  background: #a3e634;
}
.color-swatch[data-color="#49de80"] {
  background: #49de80;
}
.color-swatch[data-color="#2ed69b"] {
  background: #2ed69b;
}
.color-swatch[data-color="#2dd4c0"] {
  background: #2dd4c0;
}
.color-swatch[data-color="#24d3ee"] {
  background: #24d3ee;
}
.color-swatch[data-color="#38bdf8"] {
  background: #38bdf8;
}
.color-swatch[data-color="#61a5f8"] {
  background: #61a5f8;
}
.color-swatch[data-color="#818cf8"] {
  background: #818cf8;
}
.color-swatch[data-color="#a68cfa"] {
  background: #a68cfa;
}
.color-swatch[data-color="#c085fd"] {
  background: #c085fd;
}
.color-swatch[data-color="#e979f9"] {
  background: #e979f9;
}
.color-swatch[data-color="#fa7286"] {
  background: #fa7286;
}

.input-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  width: 100%;
  color: #bfbfbf;
}

.habit-name-input {
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  font-size: 32px;
  line-height: 40px;
  color: #2b2b2b;
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  padding: 0;
}

.habit-name-input::placeholder {
  color: #bfbfbf;
}

.habit-description-input {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  color: #555555;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  outline: none;
  width: 100%;
  background: #fafafa;
  resize: none;
  padding: 12px 16px;
  margin-top: 4px;
  min-height: 48px;
  max-height: 200px;
  overflow-y: auto;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.habit-description-input:focus {
  border-color: #226ff1;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(34, 111, 241, 0.1);
}

.habit-description-input::placeholder {
  color: #bfbfbf;
}

.save-button {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: 752px;
  max-width: calc(100% - 48px);
  background: #226ff1;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px 20px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
  z-index: 10;
}

.save-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.save-button:hover:not(:disabled) {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.1) 100%),
    linear-gradient(90deg, rgb(34, 111, 241) 0%, rgb(34, 111, 241) 100%);
  box-shadow: none;
}

.save-button:active:not(:disabled) {
  transform: translateX(-50%) translateY(1px);
}

.save-button-text {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #ffffff;
  white-space: nowrap;
  text-align: center;
}

.back-button {
  position: absolute;
  left: 198px;
  top: 24px;
  background: #f4f4f4;
  border: 1px solid #f4f4f4;
  border-radius: 73px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.2s;
  z-index: 10;
}

.back-button:hover {
  background: #e0e0e0;
}

.back-icon-container {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
}

.back-icon {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
}

/* Logout Button */
.logout-button {
  position: fixed;
  top: 24px;
  right: 24px;
  background: #F4F4F4;
  border: 1px solid #E6E6E6;
  border-radius: 8px;
  padding: 8px 20px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #2b2b2b;
  white-space: nowrap;
  z-index: 100;
  box-shadow: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.logout-button:hover {
  background: #e3e3e3;
  border-color: #E6E6E6;
  color: #2b2b2b;
  box-shadow: none;
}

.logout-button:active {
  background: #e0e0e0;
  border-color: #808080;
}

.logout-button.hidden {
  display: none !important;
}

/* Auth View */
.auth-view {
  width: 100%;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: #ffffff;
  z-index: 1;
}

.auth-container {
  width: 480px;
  max-width: 100%;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 32px;
  box-sizing: border-box;
}

.auth-title {
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  font-size: 32px;
  line-height: 40px;
  color: #2b2b2b;
  margin: 0;
  text-align: center;
}

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

.auth-input {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  color: #555555;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  outline: none;
  width: 100%;
  background: #fafafa;
  padding: 12px 16px;
  min-height: 48px;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.auth-input:focus {
  border-color: #226ff1;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(34, 111, 241, 0.1);
}

.auth-input::placeholder {
  color: #bfbfbf;
}

.auth-button {
  background: #226ff1;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px 20px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #ffffff;
  white-space: nowrap;
  transition: transform 0.2s;
  width: 100%;
}

.auth-button:hover {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.1) 100%),
    linear-gradient(90deg, rgb(34, 111, 241) 0%, rgb(34, 111, 241) 100%);
  box-shadow: none;
}

.auth-button:active {
  transform: translateY(0);
}

.auth-button-guest {
  background: #F4F4F4;
  border: 1px solid #E6E6E6;
  color: #2b2b2b;
  box-shadow: none;
  margin-top: 8px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.auth-button-guest:hover {
  background: #e3e3e3;
  border-color: #E6E6E6;
  color: #2b2b2b;
  box-shadow: none;
}

.auth-button-guest:active {
  background: #e0e0e0;
  border-color: #808080;
}

.auth-message {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #555555;
  text-align: center;
  margin: 0;
  min-height: 20px;
}

@media (max-width: 768px) {
  .illustration-container {
    width: 100%;
    height: auto;
    min-height: 200px;
  }

  .illustration-image {
    position: relative;
    width: 100%;
    height: auto;
  }

  .add-layout {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    padding-bottom: 100px;
  }

  .save-button {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: calc(100% - 32px);
  }
}

/* Habit Stack Screen */
.habit-stack-screen {
  width: 100%;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: #ffffff;
  opacity: 0;
  transform: translateX(0);
  transition: opacity 0.3s ease;
  z-index: 1;
  overflow-y: auto;
  pointer-events: none;
}

/* Show habit stack screen when not hidden (after initApp determines it should be visible) */
.habit-stack-screen:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.habit-stack-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.habit-stack-layout {
  width: 800px;
  max-width: 100%;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
}

.habit-stack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  margin-bottom: 32px;
}

.habit-stack-title {
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  font-size: 32px;
  line-height: 40px;
  color: #2b2b2b;
  flex: 1;
}

/* Habit Card */
.habit-card {
  background: #ffffff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  will-change: transform, opacity;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  transform: translateY(20px);
  animation: slideUpFadeIn 0.4s cubic-bezier(0.2, 0, 0, 1) forwards;
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1), 
              box-shadow 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}


@keyframes slideUpFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger animation for multiple cards */
.habit-card:nth-child(1) {
  animation-delay: 0.05s;
}

.habit-card:nth-child(2) {
  animation-delay: 0.1s;
}

.habit-card:nth-child(3) {
  animation-delay: 0.15s;
}

.habit-card:nth-child(4) {
  animation-delay: 0.2s;
}

.habit-card:nth-child(5) {
  animation-delay: 0.25s;
}

.habit-card:nth-child(n+6) {
  animation-delay: 0.3s;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .habit-card {
    transition: none;
    animation: none;
    opacity: 1;
    transform: translateY(0);
  }
}


/* Hover actions container - positioned on left edge */
.habit-card-hover-actions {
  position: absolute;
  left: -52px;
  top: 16px;
  display: flex;
  flex-direction: row;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.habit-card:hover .habit-card-hover-actions {
  opacity: 1;
}

.habit-card-edit,
.habit-card-delete {
  width: 44px;
  height: 31px;
  background: #ffffff;
  border: 0.5px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s ease;
  position: relative;
}

.habit-card-edit {
  border-radius: 6px 0 0 6px;
  border-right: none;
}

.habit-card-delete {
  border-radius: 0 6px 6px 0;
}

.habit-card-edit:hover,
.habit-card-delete:hover {
  background-color: #f4f4f4;
}

.habit-card-edit img {
  width: 16px;
  height: 16px;
  pointer-events: none;
  display: block;
}

.habit-card-delete img {
  width: 24px;
  height: 24px;
  pointer-events: none;
  display: block;
}

/* Undo card for deleted habits */
.habit-card-undo {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: fadeIn 0.2s ease;
}

.habit-card-undo-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.habit-card-undo-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.habit-card-undo-icon-container {
  background: #22c55e;
  border-radius: 8px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.habit-card-undo-icon {
  width: 24px;
  height: 24px;
  display: block;
  filter: brightness(0) invert(1);
}

.habit-card-undo-text {
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  font-size: 18px;
  line-height: 24px;
  color: #2b2b2b;
  margin: 0;
  white-space: nowrap;
}

.habit-card-undo-button {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 10px 16px;
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 20px;
  color: #555555;
  cursor: pointer;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.habit-card-undo-button:hover {
  background: #f4f4f4;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.habit-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.habit-card-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.habit-icon-container {
  width: 48px;
  height: 48px;
  border-radius: 73px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.habit-icon-container svg,
.habit-icon-container img {
  width: 24px;
  height: 24px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
}

.habit-text-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.habit-title {
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  font-size: 18px;
  line-height: 24px;
  color: #2b2b2b;
}

.habit-description {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  color: #555555;
}

.habit-check-button {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  box-sizing: border-box;
  position: relative;
  overflow: visible;
}

/* Bouncy animation for check button click - Apple style */
@keyframes checkButtonBounce {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(0.85);
  }
  50% {
    transform: scale(1.1);
  }
  70% {
    transform: scale(0.95);
  }
  85% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

.habit-check-button.animate-bounce {
  animation: checkButtonBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Filled state for check button - background and border are set via inline styles */

.habit-check-button .check-icon {
  width: 24px;
  height: 24px;
  display: block;
  /* Unchecked state: #555555 */
  filter: brightness(0) saturate(0%) invert(33%);
  transition: transform 0.2s ease;
}

.habit-check-button.completed .check-icon {
  /* Completed state: white */
  filter: brightness(0) invert(1);
}

/* Yearly Grid */
.habit-year-grid {
  display: grid;
  grid-template-columns: repeat(var(--day-columns, 52), var(--day-size, 24px));
  grid-template-rows: repeat(7, var(--day-size, 24px));
  grid-auto-flow: column;
  gap: 4px;
  width: 100%;
}

.year-grid-square {
  width: var(--day-size, 24px);
  height: var(--day-size, 24px);
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

/* Habit Calendar Modal */
.habit-calendar-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.habit-calendar-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.habit-calendar-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.habit-calendar-modal.is-open .habit-calendar-backdrop {
  opacity: 1;
}

.habit-calendar-content {
  position: relative;
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

.habit-calendar-modal.is-open .habit-calendar-content {
  transform: translateY(0);
}

.habit-calendar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid #e6e6e6;
  flex-shrink: 0;
}

.habit-calendar-title-container {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.habit-calendar-icon-container {
  width: 48px;
  height: 48px;
  border-radius: 73px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.habit-calendar-icon-container svg {
  width: 24px;
  height: 24px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
}

.habit-calendar-title-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.habit-calendar-title {
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  font-size: 24px;
  line-height: 32px;
  color: #2b2b2b;
  margin: 0;
}

.habit-calendar-description {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 20px;
  color: #555555;
  margin: 0;
}

.habit-calendar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.habit-calendar-share {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #555555;
  transition: background-color 0.2s cubic-bezier(0.2, 0, 0, 1);
  flex-shrink: 0;
}

.habit-calendar-share:hover {
  background-color: #f4f4f4;
}

.habit-calendar-share:active {
  background-color: #e6e6e6;
}

.habit-calendar-share .share-icon {
  width: 24px;
  height: 24px;
  display: block;
  pointer-events: none;
}

.habit-calendar-close {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #555555;
  transition: background-color 0.2s cubic-bezier(0.2, 0, 0, 1);
  flex-shrink: 0;
}

.habit-calendar-close:hover {
  background-color: #f4f4f4;
}

.habit-calendar-close:active {
  background-color: #e6e6e6;
}

.habit-calendar-close .close-icon {
  width: 24px;
  height: 24px;
  display: block;
  pointer-events: none;
}

.habit-calendar-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
}

.habit-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  width: 100%;
}

.habit-calendar-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s cubic-bezier(0.2, 0, 0, 1),
              transform 0.15s cubic-bezier(0.2, 0, 0, 1);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
}

.habit-calendar-date:active {
  transform: scale(0.95);
}

.habit-calendar-date.is-future {
  cursor: not-allowed;
  opacity: 0.4;
}

.habit-calendar-date.is-future:active {
  transform: none;
}

.habit-calendar-date.is-future:hover {
  background-color: transparent;
}

.habit-calendar-date:hover:not(.is-future) {
  background-color: #f4f4f4;
}

.habit-calendar-date-label {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #2b2b2b;
  text-align: center;
}

.habit-calendar-date.is-future .habit-calendar-date-label {
  color: #999999;
}

.habit-calendar-date-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1),
              opacity 0.2s cubic-bezier(0.2, 0, 0, 1);
  transform: scale(0);
  opacity: 0;
}

.habit-calendar-date.is-completed .habit-calendar-date-dot {
  transform: scale(1);
  opacity: 1;
}

.habit-calendar-date.is-future .habit-calendar-date-dot {
  opacity: 0.3;
}

.habit-calendar-date.is-today {
  position: relative;
}

.habit-calendar-date.is-today::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #2b2b2b;
  pointer-events: none;
}

.habit-calendar-date.is-today.is-completed::before {
  border-color: currentColor;
}

/* Custom scrollbar for modal */
.habit-calendar-body::-webkit-scrollbar {
  width: 8px;
}

.habit-calendar-body::-webkit-scrollbar-track {
  background: transparent;
}

.habit-calendar-body::-webkit-scrollbar-thumb {
  background: #bfbfbf;
  border-radius: 4px;
}

.habit-calendar-body::-webkit-scrollbar-thumb:hover {
  background: #959595;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .habit-calendar-modal,
  .habit-calendar-backdrop,
  .habit-calendar-content,
  .habit-calendar-date,
  .habit-calendar-date-dot {
    transition: none;
  }
  
  .habit-calendar-modal.is-open .habit-calendar-content {
    transform: translateY(0);
  }
  
  .habit-calendar-date:active {
    transform: none;
  }
}

/* Month labels for calendar */
.habit-calendar-month-label {
  grid-column: 1 / span 7;
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 24px;
  color: #2b2b2b;
  padding: 16px 0 8px 0;
  text-align: left;
}

.habit-calendar-weekday-label {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 12px;
  line-height: 16px;
  color: #999999;
  text-align: center;
  padding: 0 4px 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Share Menu Styles */
.share-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.2, 0, 0, 1);
}

.share-menu:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.share-menu.hidden {
  opacity: 0;
  pointer-events: none;
}

.share-menu-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 0;
}

.share-menu-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1);
  padding: 24px;
  z-index: 10;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.share-menu:not(.hidden) .share-menu-content {
  transform: translateY(0);
}

.share-menu-title {
  font-family: "Google Sans", sans-serif;
  font-weight: 500;
  font-size: 20px;
  line-height: 28px;
  color: #2b2b2b;
  margin: 0 0 20px 0;
  text-align: center;
}

.share-menu-preview {
  width: 100%;
  margin-bottom: 20px;
  border-radius: 12px;
  overflow: hidden;
  background: #f4f4f4;
  border: 1px solid #e6e6e6;
}

.share-preview-image {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
}

.share-menu-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid #e6e6e6;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  width: 100%;
  text-align: left;
  position: relative;
  z-index: 11;
  pointer-events: auto;
}

.share-option:hover {
  background: #f9f9f9;
  border-color: #d0d0d0;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.share-option:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.share-option-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  pointer-events: none;
}

.share-option-icon svg {
  pointer-events: none;
}

.x-icon {
  background: #000000;
  color: #ffffff;
}

.instagram-icon {
  background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  color: #ffffff;
}

.whatsapp-icon {
  background: #25D366;
  color: #ffffff;
}

.share-option-label {
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: #2b2b2b;
  pointer-events: none;
}

.share-menu-close {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e6e6e6;
  background: #ffffff;
  font-family: "Google Sans", sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 24px;
  color: #2b2b2b;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.share-menu-close:hover {
  background: #f4f4f4;
  border-color: #d0d0d0;
}

.share-menu-close:active {
  background: #e6e6e6;
}

/* Year grid square completed state - background color set dynamically via inline style */