:root {
  --bg-color: #f5f5f7;
  --card-bg: #ffffff;
  --text-primary: #000000;
  --text-secondary: #8e8e93;
  --border-color: #f0f0f5;
  --nav-bg: #ffffff;
  --user-accent: #000000;
  --subtle-bg: #f2f2f7;
}

[data-theme="dark"] {
  --bg-color: #0d0d0f;
  --card-bg: #161618;
  --text-primary: #f5f5f7;
  --text-secondary: #98989f;
  --border-color: #27272a;
  --nav-bg: #1c1c1e;
  --subtle-bg: #27272a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

html {
  overscroll-behavior: none;
  height: 100%;
  overflow: hidden;
}

body {
  overscroll-behavior: none;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  position: fixed;
  inset: 0;
  height: calc(var(--app-vh, 1vh) * 100);
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.3s ease, color 0.3s ease;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
}

button { border-radius: 9999px; }
::selection { background: var(--user-accent); color: #ffffff; }

.bottom-fade-overlay {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 110px;
  background: linear-gradient(to bottom, rgba(245, 245, 247, 0) 0%, var(--bg-color) 100%);
  pointer-events: none;
  z-index: 900;
  transition: background 0.3s ease;
}

[data-theme="dark"] .bottom-fade-overlay {
  background: linear-gradient(to bottom, rgba(13, 13, 15, 0) 0%, rgba(13, 13, 15, 0.95) 55%, rgba(13, 13, 15, 1) 100%);
}

@keyframes animateFromTopLeft {
  0% { opacity: 0; transform: scale(0.92) translateY(-10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes fadeSlideIn {
  0% { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideOutToRight {
  0% { opacity: 1; transform: translateX(0) scale(1); }
  100% { opacity: 0; transform: translateX(30px) scale(0.98); }
}

@keyframes scaleUpTick {
  0% { opacity: 0; transform: scale(0.4); }
  70% { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes splashFadeOutSequence {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.96); visibility: hidden; }
}

@keyframes inputFadeInSequence {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes shakeRedAnim {
  0% { transform: translateX(0); border-color: #ffb3b3; }
  20% { transform: translateX(-8px); border-color: #ffb3b3; }
  40% { transform: translateX(8px); border-color: #ffb3b3; }
  60% { transform: translateX(-6px); border-color: #ffb3b3; }
  80% { transform: translateX(6px); border-color: #ffb3b3; }
  100% { transform: translateX(0); border-color: var(--text-primary); }
}

::-webkit-scrollbar { display: none; }

.onboarding-overlay {
  position: fixed; inset: 0; width: 100vw; height: calc(var(--app-vh, 1vh) * 100); background-color: var(--bg-color);
  z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 20px; transition: opacity 0.5s ease, background-color 0.3s ease;
}
.onboarding-overlay.fade-out { opacity: 0; pointer-events: none; }

.splash-logo-container {
  position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center;
  animation: splashFadeOutSequence 0.8s cubic-bezier(0.16, 1, 0.3, 1) 1.2s forwards;
}
.splash-logo { font-size: 38px; font-weight: 700; color: var(--text-primary); letter-spacing: -1px; }

.setup-step-box {
  position: absolute; opacity: 0; pointer-events: none; transform: translateY(15px);
  transition: opacity 0.4s ease, transform 0.4s ease; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; width: 100%; max-width: 340px;
}
.setup-step-box.active-setup { opacity: 1; pointer-events: auto; transform: translateY(0); }
.setup-step-box.fade-in-input { animation: inputFadeInSequence 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

.clean-input-container { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.clean-input-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.3px; font-family: 'Poppins', sans-serif; transition: color 0.3s ease; }
.clean-input-label.error-state-label { color: #ff3b30 !important; }

.clean-transparent-input { width: 100%; background: transparent; border: none; border-bottom: 2px solid var(--text-primary); padding: 12px 0; font-family: 'Poppins', sans-serif; font-size: 22px; font-weight: 600; color: var(--text-primary); text-align: center; outline: none; transition: border-color 0.3s ease; }
.clean-transparent-input::placeholder { color: var(--text-secondary); opacity: 0.5; }
.clean-transparent-input.shake-red { animation: shakeRedAnim 0.5s ease; border-color: #ff3b30 !important; }

.color-options-grid { display: flex; gap: 12px; margin: 8px 0; justify-content: center; flex-wrap: wrap; }
.color-dot { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: transform 0.2s; position: relative; }
.color-dot:active { transform: scale(0.9); }
.color-dot.active { border-color: var(--text-primary); transform: scale(1.08); }
.custom-color-wrapper { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.custom-color-picker { width: 32px; height: 32px; border: none; border-radius: 50%; cursor: pointer; background: none; }

.success-tick-icon { font-size: 64px; color: #34c759; opacity: 0; transform: scale(0.4); }
.success-tick-icon.animate-tick { animation: scaleUpTick 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.setup-complete-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.setup-complete-sub { font-size: 13px; color: var(--text-secondary); }

.focus-picker-wrapper {
  display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; margin: 8px 0;
}
.focus-picker-box {
  height: 72px; width: 100%; overflow-x: scroll; overflow-y: hidden; scroll-snap-type: x mandatory;
  display: flex; flex-direction: row; align-items: center; position: relative;
  scrollbar-width: none; background: transparent; border: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 14%, #000 86%, transparent 100%);
}
.focus-picker-box::-webkit-scrollbar { display: none; }

.focus-picker-ring {
  position: absolute; top: 10%; bottom: 10%; left: 50%; transform: translateX(-50%);
  width: calc(var(--item-w, 64px) - 12px); border-radius: 16px; background: var(--subtle-bg);
  pointer-events: none; z-index: 1;
}

.focus-item {
  width: var(--item-w, 64px); flex-shrink: 0; scroll-snap-align: center; display: flex; align-items: center; justify-content: center;
  height: 100%; cursor: pointer; position: relative; z-index: 2;
  font-family: 'Poppins', sans-serif; font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap; padding: 0 6px; box-sizing: border-box;

  font-size: calc(12px + (1 - min(var(--focus-dist, 1), 1)) * 6px);
  opacity: calc(1 - min(var(--focus-dist, 1), 1) * 0.75);
  transform: scale(calc(1 - min(var(--focus-dist, 1), 1) * 0.18));
}
.focus-item.is-centered {
  color: var(--user-accent, var(--text-primary));
  font-weight: 700;
}
.focus-item.is-centered.age-warning {
  color: #ff3b30;
}
.focus-picker-ring.warning-ring {
  background: rgba(255, 59, 48, 0.12);
  border: 1px solid rgba(255, 59, 48, 0.4);
}
.focus-picker-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.3px; }

.focus-picker-empty-hint {
  font-size: 12px; color: var(--text-secondary); font-weight: 500; text-align: center;
}

.collapsible-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--subtle-bg); border-radius: 9999px; padding: 12px 18px; cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
.collapsible-trigger:active { transform: scale(0.98); }
.collapsible-chevron { font-size: 15px; color: var(--text-secondary); transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.collapsible-trigger.expanded .collapsible-chevron { transform: rotate(180deg); }

.collapsible-body {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}
.collapsible-body > * { overflow: hidden; min-height: 0; }
.collapsible-body.open { grid-template-rows: 1fr; opacity: 1; }

.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: calc(max(8px, env(safe-area-inset-top)) + 4px) 16px 8px;
  background: #ff9500; color: #ffffff; font-size: 12px; font-weight: 700;
  transform: translateY(-100%); transition: transform 250ms ease;
  text-align: center;
}
.offline-banner.visible { transform: translateY(0); }
.offline-banner i { font-size: 14px; }

.app-screen {
  position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 420px; padding: 0 24px calc(120px + env(safe-area-inset-bottom));
  display: none; justify-content: flex-start; flex-direction: column; align-items: center; gap: 16px;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  transform-origin: top center;
}
.app-screen.active-screen { display: flex; animation: appScreenIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes appScreenIn {
  0% { opacity: 0; transform: translateX(-50%) scale(0.97) translateY(-6px); }
  100% { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

@media (max-width: 359px) {
  .app-screen { padding: 0 16px calc(120px + env(safe-area-inset-bottom)); }
}
@media (min-width: 600px) {
  .app-screen { max-width: 480px; }
}
@media (min-width: 900px) {
  .app-screen { max-width: 1080px; }

  .home-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) 1fr;
    grid-template-areas:
      "calendar documents"
      "weather documents"
      "news documents";
    gap: 20px;
    align-items: start;
    width: 100%;
  }
  .calendar-widget { grid-area: calendar; }
  .weather-card { grid-area: weather; }
  .news-card { grid-area: news; }
  .home-documents-panel {
    grid-area: documents; display: block; width: 100%; background: var(--card-bg);
    border: 1px solid var(--border-color); border-radius: 22px; padding: 20px;
    max-height: 74vh; overflow-y: auto;
  }

  .nav-bottom { bottom: 32px; }
  .nav-wrapper { padding: 10px 14px; border-radius: 22px; }
  .nav-links { gap: 10px; }
  .nav-item { flex-direction: row; width: auto; height: 52px; padding: 0 20px; gap: 10px; border-radius: 16px; }
  .nav-item:hover { background: var(--subtle-bg); }
  .nav-item i { font-size: 22px; }
  .nav-item span { display: inline; font-size: 14px; font-weight: 700; font-family: 'Poppins', sans-serif; white-space: nowrap; }
  .nav-item.active::after { display: none; }
  .nav-item.active { background: var(--subtle-bg); }
}

.home-documents-panel { display: none; }
.home-documents-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.home-documents-panel-header .doc-float-btn { padding: 0 16px; height: 38px; font-size: 12px; width: auto; }

.top-header { width: 100%; padding: 16px 0 4px 0; text-align: center; }
.top-header h1 { font-size: 22px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.5px; }

.calendar-widget { background: transparent; width: 100%; }
.time-date-header { margin-bottom: 50px; margin-top: 50px; }
.clock-display { font-size: 32px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.5px; line-height: 1.1; }
.event-status { font-size: 13px; color: var(--text-secondary); font-weight: 500; margin-top: 2px; }

.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.calendar-month { font-weight: 600; font-size: 15px; color: var(--text-primary); min-width: 130px; text-align: center; }
.cal-nav-btn {
  width: 30px; height: 30px; border-radius: 50%; border: none; background: var(--card-bg);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05); color: var(--text-primary); font-size: 13px;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.cal-nav-btn:active { transform: scale(0.88); opacity: 0.8; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; width: 100%; }
.day-name { font-size: 10px; font-weight: 600; color: var(--text-secondary); margin-bottom: 2px; }
.day-cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: var(--text-primary); border-radius: 50%; border: 0;
  background: transparent; font-family: 'Poppins', sans-serif;
  cursor: pointer; user-select: none; transition: background-color 0.2s ease, transform 0.15s ease;
  position: relative;
}
.day-cell.empty-cell { cursor: default; }
.day-cell.empty-cell:active { transform: none; }
.day-cell:not(.empty-cell):active { transform: scale(0.9); }
.day-cell:not(.empty-cell):hover { background-color: var(--subtle-bg); }
.day-cell.today { background-color: var(--user-accent, var(--text-primary)); color: #ffffff; font-weight: 600; }
.day-cell.has-event::after {
  content: ''; position: absolute; bottom: 3px; width: 4px; height: 4px;
  background-color: var(--text-secondary); border-radius: 50%;
}
.day-cell.today.has-event::after { background-color: #ffffff; }

.today-jump-btn {
  width: 100%; margin-top: 10px; background: var(--card-bg); color: var(--text-primary); border: none;
  padding: 10px; border-radius: 9999px; font-family: 'Poppins', sans-serif; font-size: 12px; font-weight: 600;
  cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,0.04); transition: transform 0.15s ease;
}
.today-jump-btn:active { transform: scale(0.97); }

.weather-card {
  background-color: var(--user-accent, var(--text-primary)); border-radius: 20px; padding: 18px; color: #ffffff;
  display: flex; flex-direction: column; gap: 12px; width: 100%; transition: background-color 0.3s ease;
}
.weather-header { display: flex; justify-content: space-between; align-items: center; }
.weather-temp { font-size: 28px; font-weight: 700; }
.weather-location { font-size: 12px; color: rgba(255, 255, 255, 0.8); }
.weather-graph-svg { width: 100%; height: 40px; overflow: visible; }
.map-setup-btn {
  align-self: flex-start; background-color: rgba(255, 255, 255, 0.2); color: #ffffff; border: none;
  padding: 8px 16px; border-radius: 9999px; font-family: 'Poppins', sans-serif; font-size: 11px; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: opacity 0.2s ease, transform 0.15s ease;
}
.map-setup-btn:active { transform: scale(0.96); }
.map-setup-btn:disabled { opacity: 0.5; cursor: default; pointer-events: none; }

.news-card {
  background-color: var(--card-bg); border-radius: 20px; padding: 18px; display: flex;
  flex-direction: column; gap: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); width: 100%;
}
.news-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 8px; }
.news-title { display: flex; align-self: center; font-size: 15px; font-weight: 600; color: var(--text-primary); }
.news-item { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--border-color); text-decoration: none; }
.news-item:last-child { border-bottom: none; padding-bottom: 0; }
.news-item-title { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.news-item-snippet { font-size: 11px; color: var(--text-secondary); line-height: 1.3; }

.documents-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 52vh; text-align: center; gap: 12px; width: 100%;
}
.documents-icon-wrapper {
  width: 64px; height: 64px; background-color: var(--card-bg); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(0,0,0,0.04); margin-bottom: 4px;
}
.documents-icon-wrapper i { font-size: 28px; color: var(--user-accent, var(--text-primary)); }
.documents-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.documents-subtext { font-size: 13px; color: var(--text-secondary); }

.documents-content-wrapper {
  display: flex; flex-direction: column; gap: 14px; width: 100%; padding-bottom: 40px; align-items: center;
  animation: fadeSlideIn 0.3s cubic-bezier(0.16,1,0.3,1) forwards;
}

.doc-search-bar {
  width: 100%; background: var(--card-bg); border-radius: 9999px; padding: 12px 18px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
.doc-search-bar i { font-size: 18px; color: var(--text-secondary); }
.doc-search-input { width: 100%; border: none; background: transparent; font-family: 'Poppins', sans-serif; font-size: 13px; color: var(--text-primary); outline: none; font-weight: 500; }
.doc-search-input::placeholder { color: var(--text-secondary); }

.doc-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }

.doc-section { margin-bottom: 14px; }
.doc-section-header {
  width: 100%; display: flex; align-items: center; gap: 8px; border: none; background: transparent;
  padding: 4px 2px 10px; cursor: pointer; font-family: 'Poppins', sans-serif;
  color: var(--text-secondary); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.doc-section-header i:first-child { font-size: 13px; color: var(--user-accent); }
.doc-section-count { background: var(--subtle-bg); color: var(--text-secondary); border-radius: 9999px; padding: 1px 8px; font-size: 10.5px; }
.doc-section-chevron { margin-left: auto; font-size: 14px; transition: transform 0.2s ease; }
.doc-section-header.collapsed .doc-section-chevron { transform: rotate(-90deg); }
.doc-section-body {
  display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.25s ease;
  overflow: hidden;
}
.doc-section-body > .doc-list { min-height: 0; }
.doc-section-body.collapsed { grid-template-rows: 0fr; }
.doc-section-body.collapsed > .doc-list { overflow: hidden; }

.doc-row {
  background: var(--card-bg); border-radius: 18px; padding: 12px 14px; display: flex;
  align-items: center; gap: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  cursor: pointer; user-select: none; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.doc-row:active { transform: scale(0.98); }
.doc-row-chip {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
  background: var(--card-accent, var(--user-accent, #5c5c66)); color: #ffffff;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  transition: transform 0.15s ease;
}
.doc-row:active .doc-row-chip { transform: scale(0.92); }
.doc-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-row-title { font-size: 14px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row-meta { font-size: 11px; color: var(--text-secondary); font-weight: 500; letter-spacing: 0.1px; }
.doc-row-drag { flex-shrink: 0; color: var(--text-secondary); font-size: 16px; cursor: grab; padding: 6px; }

.doc-float-btn {
  height: 38px; border-radius: 9999px; background-color: var(--user-accent, var(--text-primary)); color: #ffffff;
  border: none; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08); cursor: pointer; transition: transform 0.15s ease;
  font-family: 'Poppins', sans-serif; font-size: 12px; font-weight: 500; padding: 0 16px; gap: 6px; white-space: nowrap;
}
.doc-float-btn:active { transform: scale(0.95); }
.doc-float-btn i { font-size: 16px; }
.doc-float-btn.template-btn { background-color: var(--card-bg); color: var(--text-primary); border: 1px solid var(--border-color); }

.doc-wizard-overlay {
  position: fixed; inset: 0; width: 100vw; height: calc(var(--app-vh, 1vh) * 100); background-color: var(--bg-color);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); z-index: 3000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px;
  opacity: 0; pointer-events: none; transform: scale(0.96) translateY(20px);
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.doc-wizard-overlay.active { opacity: 1; pointer-events: auto; transform: scale(1) translateY(0); }

.wizard-step { width: 100%; max-width: 320px; display: none; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.wizard-step.step-visible { display: flex; animation: animateFromTopLeft 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

.palette-pencil-wrapper { position: relative; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.palette-pencil-wrapper i.hgi-paint-board { font-size: 40px; color: var(--text-primary); }
.palette-pencil-wrapper i.hgi-pencil-edit-01 { position: absolute; bottom: -2px; right: -8px; font-size: 18px; color: var(--text-primary); background: var(--bg-color); border-radius: 50%; padding: 2px; }
.setup-title-text { font-size: 20px; font-weight: 600; color: var(--text-primary); font-family: 'Poppins', sans-serif; }
.color-options { display: flex; gap: 14px; margin: 8px 0; justify-content: center; }
.color-dot-doc { width: 32px; height: 32px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: transform 0.2s; }
.color-dot-doc:active { transform: scale(0.9); }
.color-dot-doc.active { border-color: var(--text-primary); }

.btn-rounded-setup {
  background-color: var(--user-accent, var(--text-primary)); color: #ffffff; border: none; padding: 12px 28px; border-radius: 9999px;
  font-family: 'Poppins', sans-serif; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  transition: transform 0.2s;
}
.btn-rounded-setup:active { transform: scale(0.95); }
.btn-rounded-setup:disabled { opacity: 0.4; pointer-events: none; box-shadow: none; }

.editor-screen {
  position: fixed; inset: 0; width: 100vw; height: calc(var(--app-vh, 1vh) * 100); background-color: var(--bg-color);
  z-index: 3000; display: none; flex-direction: column; padding: 24px 20px;
  opacity: 0; pointer-events: none; transform: scale(0.92) translateY(20px);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.editor-screen.active { 
  display: flex; opacity: 1; pointer-events: auto; transform: scale(1) translateY(0); 
  animation: animateFromTopLeft 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
}
.editor-screen.closing { 
  display: flex; opacity: 0; pointer-events: none; animation: slideOutToRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; 
}

.editor-header-layout {
  display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 420px; align-self: center; margin-top: 40px; margin-bottom: 16px;
}
.editor-topbar { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 12px; }
.editor-back-btn {
  width: 44px; height: 44px; background: var(--card-bg); border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.04); cursor: pointer; flex-shrink: 0;
  transition: transform 0.15s ease;
}
.editor-back-btn:active { transform: scale(0.9); }
.editor-back-btn i { font-size: 20px; color: var(--text-primary); }

.editor-title-container {
  display: flex; align-items: center; justify-content: center; gap: 6px; flex: 1; min-width: 0; background: var(--card-bg); padding: 0 16px; height: 44px; border-radius: 9999px; border: 1px solid var(--border-color); box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.editor-title-display {
  font-family: 'Poppins', sans-serif; font-size: 16px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; outline: none; border: none; background: transparent; text-align: right;
}
.editor-word-count { font-size: 12px; font-weight: 600; color: var(--text-secondary); background: var(--card-bg); padding: 0 16px; height: 44px; border-radius: 9999px; box-shadow: 0 4px 12px rgba(0,0,0,0.04); display: flex; align-items: center; flex-shrink: 0; font-family: 'Poppins', sans-serif; }

.text-tools-bar {
  display: flex; align-items: center; gap: 6px; background: var(--card-bg); border-radius: 9999px; padding: 5px 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06); overflow-x: auto; width: 100%; height: 48px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; border: 1px solid var(--border-color);
}
.text-tools-bar::-webkit-scrollbar { display: none; }

.text-tool-btn {
  display: flex; align-items: center; justify-content: center; gap: 5px; height: 36px; border-radius: 9999px; color: var(--text-primary); background: var(--subtle-bg); border: none; text-decoration: none; cursor: pointer; padding: 0 12px; transition: all 0.2s ease; flex-shrink: 0;
}
.text-tool-btn i { font-size: 15px; line-height: 1; flex-shrink: 0; color: var(--text-primary); }
.text-tool-btn span { display: inline-block; font-size: 11px; font-weight: 600; white-space: nowrap; font-family: 'Poppins', sans-serif; color: var(--text-secondary); }
.text-tool-btn:active { background-color: var(--user-accent, var(--text-primary)); color: #ffffff; transform: scale(0.95); }
.text-tool-btn:active i, .text-tool-btn:active span { color: #ffffff; }

.text-tool-select {
  appearance: none; -webkit-appearance: none; background: var(--subtle-bg); border: none; border-radius: 9999px;
  height: 36px; padding: 0 14px; font-family: 'Poppins', sans-serif; font-size: 11px; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; outline: none; flex-shrink: 0; transition: background 0.2s;
}
.template-popup {
  position: fixed; inset: 0; width: 100vw; height: calc(var(--app-vh, 1vh) * 100); background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 4000;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.template-popup.active { display: flex; }
.template-popup .inside-options {
  background: var(--card-bg); border-radius: 20px; padding: 20px; width: 100%; max-width: 380px;
  max-height: 70vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}
.template-popup-heading { text-align: left; margin-bottom: 14px; }
.template-popup-heading h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; margin: 0 0 4px 0; }
.template-popup-heading p { font-size: 13px; color: var(--text-secondary); margin: 0; font-weight: 400; }
.template-search-bar { margin-bottom: 14px; }
.template-list-container { display: flex; flex-direction: column; gap: 8px; }
.template-list-container .doc-row {
  background: var(--subtle-bg); border-radius: 14px; padding: 10px 12px; cursor: pointer;
  animation: fadeSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.template-list-container .doc-row:nth-child(1) { animation-delay: 0.02s; }
.template-list-container .doc-row:nth-child(2) { animation-delay: 0.05s; }
.template-list-container .doc-row:nth-child(3) { animation-delay: 0.08s; }
.template-list-container .doc-row:nth-child(4) { animation-delay: 0.11s; }
.template-list-container .doc-row:nth-child(5) { animation-delay: 0.14s; }
.template-list-container .doc-row:nth-child(n+6) { animation-delay: 0.16s; }
.template-list-container .doc-row:active { transform: scale(0.97); }

.toolbar-morph-container {
  display: flex; align-items: center; justify-content: center; width: 100%; position: relative; min-height: 40px;
}
.morph-toolbar-pill {
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 9999px; height: 40px; padding: 0 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px; font-family: 'Poppins', sans-serif;
  box-shadow: 0 6px 20px rgba(0,0,0,0.06); cursor: pointer; overflow: hidden; width: 140px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease; white-space: nowrap;
}
.morph-compact-content { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; opacity: 1; transition: opacity 0.2s ease; }
.morph-expanded-content {
  position: absolute; display: flex; align-items: center; gap: 6px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease 0.1s; overflow-x: auto; width: calc(100% - 16px); padding: 0 4px; scrollbar-width: none;
}
.morph-toolbar-pill.is-expanded { width: 100%; padding: 5px 8px; cursor: default; }
.morph-toolbar-pill.is-expanded .morph-compact-content { opacity: 0; pointer-events: none; width: 0; overflow: hidden; }
.morph-toolbar-pill.is-expanded .morph-expanded-content { opacity: 1; pointer-events: auto; position: relative; }
.shrink-tool-btn { background: var(--user-accent, var(--text-primary)) !important; color: #ffffff !important; flex-shrink: 0; }
.shrink-tool-btn i, .shrink-tool-btn span { color: #ffffff !important; }

.editor-body-container { 
  flex: 1; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; padding-bottom: 60px; 
  max-width: 420px; width: 100%; align-self: center; -webkit-overflow-scrolling: touch; background: transparent; padding: 10px 4px;
}
.editor-textarea { 
  width: 100%; flex: 1; background: transparent; border: none; font-family: 'Poppins', sans-serif; 
  font-size: 15px; line-height: 1.6; color: var(--text-primary); outline: none; resize: none; min-height: 350px; 
}

.day-view-overlay {
  position: fixed; inset: 0; width: 100vw; height: calc(var(--app-vh, 1vh) * 100); background-color: var(--bg-color);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); z-index: 3000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px;
  opacity: 0; pointer-events: none; transform: scale(0.96) translateY(30px);
  transition: opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1), transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.day-view-overlay.active { opacity: 1; pointer-events: auto; transform: scale(1) translateY(0); }

.floating-back-btn {
  position: absolute; top: 28px; left: 24px; width: 44px; height: 44px; background-color: var(--user-accent, var(--text-primary)); color: #ffffff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12); border: none; z-index: 3100;
}
.setup-step { width: 100%; max-width: 320px; display: none; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.setup-step.step-visible { display: flex; animation: animateFromTopLeft 0.3s cubic-bezier(0.16,1,0.3,1) forwards; }

.events-list-container { 
  width: 100%; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; margin-bottom: 6px; -webkit-overflow-scrolling: touch; 
}
.event-row-card {
  background: var(--card-bg); padding: 12px 14px; border-radius: 14px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03); text-align: left; width: 100%;
}
.event-row-info { display: flex; flex-direction: column; gap: 2px; }
.event-row-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.event-row-time { font-size: 11px; color: var(--text-secondary); font-weight: 500; }
.event-type-badge { font-size: 10px; padding: 3px 8px; border-radius: 999px; font-weight: 600; width: max-content; }
.badge-world { background: var(--subtle-bg); color: var(--text-secondary); }
.badge-personal { background: var(--user-accent, var(--text-primary)); color: #ffffff; }

.profile-section-card {
  background: var(--card-bg); border-radius: 32px; padding: 22px 24px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); width: 100%;
  display: flex; flex-direction: column; gap: 14px; text-align: left; margin-bottom: 16px; border: 1px solid var(--border-color);
  transform: translateY(0); transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.profile-section-card:hover { transform: translateY(-2px); box-shadow: 0 14px 35px rgba(0,0,0,0.08); }

.profile-header-card {
  background: var(--card-bg); border-radius: 24px; padding: 18px 20px; width: 100%;
  display: flex; align-items: center; gap: 14px; text-align: left; margin-bottom: 16px;
  border: 1px solid var(--border-color); box-shadow: 0 10px 30px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.profile-header-card:active { transform: scale(0.98); }
.profile-avatar-circle {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: var(--user-accent, var(--text-primary)); color: #ffffff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; font-family: 'Poppins', sans-serif;
}

.profile-row-pill {
  display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 6px 0;
  background: transparent; border: none; font-family: 'Poppins', sans-serif; text-align: left;
}
.profile-row-info { display: flex; flex-direction: column; gap: 2px; }
.profile-row-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.profile-row-sub { font-size: 11px; color: var(--text-secondary); }

.theme-switch-pill {
  background: var(--subtle-bg); border-radius: 9999px; padding: 3px; display: flex; gap: 2px;
}
.theme-pill-btn {
  background: transparent; border: none; padding: 6px 14px; border-radius: 9999px; font-family: 'Poppins', sans-serif;
  font-size: 11px; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: all 0.2s ease;
}
.theme-pill-btn.active { background: var(--card-bg); color: var(--text-primary); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.danger-action-btn {
  background: #fff5f5; color: #ff3b30; border: 1px solid #ffe3e3; padding: 8px 16px; border-radius: 9999px;
  font-family: 'Poppins', sans-serif; font-size: 11px; font-weight: 600; cursor: pointer; transition: transform 0.15s ease;
}
.danger-action-btn:active { transform: scale(0.95); }

.pz-mini-toggle {
  width: 38px; height: 22px; border-radius: 9999px; background: var(--border-color); position: relative;
  cursor: pointer; flex-shrink: 0; transition: background-color 0.2s ease;
}
.pz-mini-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #ffffff; box-shadow: 0 1px 4px rgba(0,0,0,0.2); transition: transform 0.2s cubic-bezier(0.16,1,0.3,1);
}
.pz-mini-toggle.active { background: var(--user-accent, #34c759); }
.pz-mini-toggle.active::after { transform: translateX(16px); }

.pz-feature-lock-list { display: flex; flex-direction: column; gap: 4px; }
.pz-feature-row {
  display: flex; align-items: center; justify-content: space-between; padding: 8px 2px;
}
.pz-feature-info { display: flex; align-items: center; gap: 10px; }
.pz-feature-info i { font-size: 16px; color: var(--text-secondary); width: 20px; text-align: center; }
.pz-feature-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }

.nav-bottom { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); width: auto; z-index: 1000; transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
.nav-bottom.nav-hidden { opacity: 0; transform: translate(-50%, 90px); pointer-events: none; }
.nav-wrapper { background-color: var(--nav-bg); border-radius: 9999px; padding: 6px 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); border: 1px solid var(--border-color); }
.nav-links { display: flex; align-items: center; justify-content: center; gap: 6px; }
.nav-item { 
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; 
  height: 48px; width: 56px; border-radius: 16px; color: var(--text-secondary); text-decoration: none; cursor: pointer; 
  position: relative; transition: color 0.25s ease; 
}
.nav-item i { font-size: 20px; line-height: 1; flex-shrink: 0; transition: transform 0.2s ease; }
.nav-item span { display: none; }
.nav-item:active i { transform: scale(0.85); }
.nav-item.active { color: var(--user-accent, var(--text-primary)); }

.nav-item.active::after {
  content: ''; position: absolute; bottom: 4px; width: 12px; height: 2px;
  background-color: var(--user-accent, var(--text-primary)); border-radius: 999px;
  animation: scaleUpTick 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.profile-modal-overlay {
  position: fixed; inset: 0; width: 100vw; height: calc(var(--app-vh, 1vh) * 100);
  background-color: rgba(0, 0, 0, 0.4); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  z-index: 4000; display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}

.profile-modal-overlay.active {
  opacity: 1; pointer-events: auto;
}

.profile-modal-card {
  background: var(--bg-color); border-radius: 28px 28px 0 0;
  width: 100%; max-width: 440px; max-height: 85vh; display: flex; flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15); transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-modal-overlay.active .profile-modal-card {
  transform: translateY(0);
}

.profile-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px 12px 24px; border-bottom: 1px solid var(--border-color);
}

.modal-close-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--subtle-bg); color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: transform 0.15s ease;
}

.modal-close-btn:active { transform: scale(0.9); }

.profile-modal-body {
  padding: 20px 24px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 4px;
}

.profile-age-picker-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: var(--subtle-bg); border-radius: 14px; padding: 12px 14px; cursor: pointer;
  transition: transform 0.15s ease;
}
.profile-age-picker-trigger:active { transform: scale(0.98); }

#screen-documents { padding-top: 18px; }
.documents-heading { width: 100%; display: flex; align-items: flex-end; justify-content: space-between; margin: 6px 0 14px; }
.documents-heading h2 { margin-top: 2px; font-size: 28px; line-height: 1; letter-spacing: 0; color: var(--text-primary); }
.documents-eyebrow { color: var(--user-accent); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; }
.documents-count { padding: 7px 11px; border-radius: 9999px; background: var(--subtle-bg); color: var(--text-secondary); font-size: 10px; font-weight: 600; }
.documents-actions { width: 100%; display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; margin: 2px 0 16px; }
.doc-float-btn { min-height: 44px; padding: 0 13px; border-radius: 9999px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--user-accent); color: #fff; border: 1px solid transparent; box-shadow: 0 7px 16px rgba(0,0,0,0.08); font-size: 11px; font-weight: 700; cursor: pointer; }
.doc-float-btn.template-btn { background: var(--card-bg); color: var(--text-primary); border-color: var(--border-color); box-shadow: none; }
.doc-float-btn:hover, .doc-float-btn:focus-visible { transform: translateY(-1px); filter: brightness(1.04); outline: none; }
.doc-search-bar { padding: 13px 16px; border: 1px solid var(--border-color); box-shadow: none; background: var(--card-bg); }
.documents-content-wrapper { padding-bottom: 32px; }
.doc-list { gap: 10px; }
.doc-row { min-height: 74px; padding: 12px 13px; border: 1px solid var(--border-color); border-radius: 20px; box-shadow: 0 7px 18px rgba(0,0,0,0.035); background: var(--card-bg); position: relative; z-index: 1; }
.doc-row:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(0,0,0,0.08); }
.doc-row-swipe-wrap { position: relative; }
.doc-row-swipe-wrap .doc-row { margin-bottom: 0; }
.doc-row-delete-backdrop {
  position: absolute; inset: 0; border-radius: 20px; background: #ff3b30; color: #ffffff;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 26px; font-size: 19px;
  opacity: 0.9;
}
.doc-row-pin-backdrop {
  position: absolute; inset: 0; border-radius: 20px; background: var(--user-accent); color: #ffffff;
  display: flex; align-items: center; justify-content: flex-start; padding-left: 26px; font-size: 19px;
  opacity: 0.9; z-index: 0;
}
.doc-row-swipe-wrap .doc-row.swipe-armed { box-shadow: 0 0 0 2px #ff3b30 inset; }
.doc-row-swipe-wrap .doc-row.swipe-armed-right { box-shadow: 0 0 0 2px var(--user-accent) inset; }
.doc-row.is-pinned { border-color: var(--user-accent); }
.doc-row-pin-icon { font-size: 12px; color: var(--user-accent); margin-right: 5px; }
.doc-row-chip { width: 42px; height: 42px; border-radius: 15px; }
.doc-row-drag { width: 30px; height: 30px; border-radius: 9999px; display: flex; align-items: center; justify-content: center; background: var(--subtle-bg); }
.documents-empty-state { min-height: 46vh; padding: 24px; border: 1px dashed var(--border-color); border-radius: 26px; background: var(--card-bg); }
.documents-empty-state .documents-icon-wrapper { background: var(--subtle-bg); }

.mood-insights-card {
  width: 100%; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 22px;
  padding: 16px; margin: 0 0 16px; box-shadow: 0 7px 18px rgba(0,0,0,0.035);
}
.mood-insights-header {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700;
  color: var(--text-primary); margin-bottom: 14px;
}
.mood-insights-header i { font-size: 15px; color: var(--user-accent); }
.mood-insights-body { display: flex; align-items: flex-start; gap: 18px; }
.mood-insights-caption { display: block; font-size: 10.5px; color: var(--text-secondary); margin-top: 8px; }

.mood-graph-col { flex: 1; min-width: 0; }
.mood-graph-track {
  display: flex; align-items: flex-end; gap: 6px; height: 64px; padding: 0 2px;
}
.mood-graph-bar-wrap { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.mood-graph-bar { width: 100%; border-radius: 6px 6px 3px 3px; min-height: 6px; transition: height 0.3s ease; }

.mood-pie-col { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.mood-pie { width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 5px var(--card-bg); }
.mood-legend { display: flex; flex-direction: column; gap: 4px; }
.mood-legend-row { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text-secondary); }
.mood-legend-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.mood-legend-label { color: var(--text-primary); font-weight: 600; }
.mood-legend-pct { opacity: 0.65; }

.mood-words-row { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-color); }
.mood-words-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mood-word-chip {
  padding: 4px 11px; border-radius: 9999px; background: var(--subtle-bg); color: var(--text-primary);
  font-weight: 600; line-height: 1;
}

@media (max-width: 380px) {
  .mood-insights-body { flex-direction: column; }
  .mood-pie-col { align-self: stretch; }
}

@media (max-width: 420px) { .documents-heading h2 { font-size: 25px; } .documents-actions { grid-template-columns: 1fr 1fr; } .doc-float-btn { padding: 0 8px; font-size: 10px; } }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, [role="button"], summary, label, select, .nav-item { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--user-accent, #0a84ff); outline-offset: 2px; }
input:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible { outline-offset: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
.zydox-reduced-motion *, .zydox-low-power * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }

.home-greeting-wrap { width: 100%; padding: 4px 0 14px; display: flex; flex-direction: column; gap: 14px; }
.home-greeting { font-size: 24px; font-weight: 600; letter-spacing: -0.5px; color: var(--text-primary); }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border: 1px solid var(--border-color); border-radius: 20px; background: var(--card-bg); color: var(--text-primary); font: 600 12px 'Poppins', sans-serif; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.03); transition: transform .15s ease; }
.quick-btn i { font-size: 22px; color: var(--user-accent, var(--text-primary)); }
.quick-btn:active { transform: scale(0.95); }
.tools-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
.tool-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border: 1px solid var(--border-color); border-radius: 22px; background: var(--card-bg); color: var(--text-primary); text-align: left; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.03); transition: transform .15s ease; }
.tool-tile:active { transform: scale(0.97); }
.tool-tile-icon { width: 42px; height: 42px; border-radius: 14px; display: flex; align-items: center; justify-content: center; background: var(--subtle-bg); margin-bottom: 8px; }
.tool-tile-icon i { font-size: 22px; color: var(--user-accent, var(--text-primary)); }
.tool-tile-title { font-size: 15px; font-weight: 600; }
.tool-tile-sub { font-size: 12px; color: var(--text-secondary); }
.tool-panel { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.tool-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--text-secondary); font: 500 13px 'Poppins', sans-serif; cursor: pointer; padding: 4px 0; min-height: 36px; }
.tool-heading { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; }
.tool-row { display: flex; gap: 10px; align-items: center; }
.tool-row.center { justify-content: center; }
.tool-input { flex: 1; width: 100%; min-height: 46px; padding: 12px 16px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--card-bg); color: var(--text-primary); font: 400 16px 'Poppins', sans-serif; outline: none; }
.tool-input.tall { min-height: 150px; resize: vertical; }
.tool-input:focus { border-color: var(--user-accent, var(--text-primary)); }
.tool-btn { min-height: 46px; padding: 0 22px; border: 0; border-radius: 9999px; background: var(--user-accent, #000); color: #fff; font: 600 14px 'Poppins', sans-serif; cursor: pointer; }
.tool-btn.secondary { background: var(--subtle-bg); color: var(--text-primary); }
.tool-btn.secondary.active { outline: 2px solid var(--user-accent, #000); }
.tool-link { border: 0; background: transparent; color: var(--text-secondary); font: 500 12px 'Poppins', sans-serif; cursor: pointer; min-height: 32px; }
.tool-chips { display: flex; gap: 8px; }
.tool-chips.wrap { flex-wrap: wrap; }
.tool-chip { min-height: 36px; padding: 0 14px; border: 1px solid var(--border-color); border-radius: 9999px; background: var(--card-bg); color: var(--text-secondary); font: 500 13px 'Poppins', sans-serif; text-transform: capitalize; cursor: pointer; }
.tool-chip.active { background: var(--user-accent, #000); border-color: transparent; color: #fff; }
.tool-label { font-size: 13px; color: var(--text-secondary); }
.tool-range { width: 100%; accent-color: var(--user-accent, #000); }
.tool-empty { padding: 28px; text-align: center; color: var(--text-secondary); font-size: 13px; border: 1px dashed var(--border-color); border-radius: 18px; }
.tool-footer { display: flex; justify-content: space-between; align-items: center; color: var(--text-secondary); font-size: 12px; }
.task-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--border-color); border-radius: 16px; background: var(--card-bg); }
.task-text { flex: 1; font-size: 14px; word-break: break-word; }
.task-item.done .task-text { text-decoration: line-through; color: var(--text-secondary); }
.task-check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-color); background: transparent; color: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.task-item.done .task-check { background: var(--user-accent, #000); border-color: transparent; color: #fff; }
.task-del { border: 0; background: transparent; color: var(--text-secondary); font-size: 18px; cursor: pointer; min-width: 36px; min-height: 36px; }
.tool-sub-time { font-size: 11px; color: var(--text-secondary); }
.focus-ring { position: relative; width: 220px; height: 220px; margin: 8px auto; }
.focus-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--subtle-bg); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--user-accent, #000); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
.focus-time { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 600; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { padding: 14px; border: 1px solid var(--border-color); border-radius: 18px; background: var(--card-bg); }
.stat-v { font-size: 20px; font-weight: 600; }
.stat-l { font-size: 12px; color: var(--text-secondary); }
.prompt-card { padding: 28px 22px; border-radius: 24px; background: var(--card-bg); border: 1px solid var(--border-color); font: italic 600 20px 'Playfair Display', serif; line-height: 1.4; text-align: center; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.pw-out { padding: 18px; border-radius: 18px; background: var(--card-bg); border: 1px solid var(--border-color); font: 500 17px 'Fira Code', monospace; word-break: break-all; text-align: center; }
.mood-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mood-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border: 1px solid var(--border-color); border-radius: 18px; background: var(--card-bg); color: var(--text-primary); cursor: pointer; }
.mood-num { font-size: 20px; font-weight: 600; }
.mood-name { font-size: 11px; color: var(--text-secondary); }
.mood-chart { display: flex; align-items: flex-end; gap: 6px; height: 100px; padding: 8px; border: 1px solid var(--border-color); border-radius: 18px; background: var(--card-bg); }
.mood-bar { flex: 1; border-radius: 6px; background: var(--user-accent, #000); min-width: 6px; }
.sketch-canvas { width: 100%; border: 1px solid var(--border-color); border-radius: 20px; background: #fff; touch-action: none; }
.sk-color { width: 46px; height: 46px; border: 0; border-radius: 50%; padding: 0; background: none; }

html, body { max-width: 100%; overflow-x: hidden; overscroll-behavior-y: none; }
img, canvas, video, svg { max-width: 100%; }
.nav-bottom { transition: transform .28s cubic-bezier(.16,1,.3,1), opacity .2s ease; padding-bottom: env(safe-area-inset-bottom); }
body.kb-open .nav-bottom, body.is-typing .nav-bottom { transform: translateY(160%); opacity: 0; pointer-events: none; }
.editor-bottom-pill-bar { bottom: 22px; transition: bottom .2s ease; }
body.kb-open .editor-bottom-pill-bar { bottom: 10px; }
.editor-body-container { padding-bottom: 110px; scroll-padding-bottom: 90px; }
.editor-screen { padding-top: env(safe-area-inset-top); }
@media (pointer: coarse) {
  input, textarea, select, [contenteditable="true"] { font-size: max(16px, 1em); }
  button, .nav-item, .doc-row, .tool-chip { min-height: 40px; }
}
@media (max-width: 359px) {
  .quick-actions { gap: 6px; }
  .quick-btn { padding: 12px 2px; font-size: 11px; border-radius: 16px; }
  .tools-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .mood-row { gap: 4px; }
  .home-greeting { font-size: 21px; }
  .focus-ring { width: 180px; height: 180px; }
  .focus-time { font-size: 36px; }
}
.quick-btn span, .tool-tile-title, .tool-tile-sub, .task-text { min-width: 0; overflow-wrap: anywhere; }
.tool-btn.small { min-height: 36px; padding: 0 14px; font-size: 12px; }
.tool-note { font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.deck-row .tool-btn { flex-shrink: 0; }
.flash-card { width: 100%; min-height: 240px; padding: 24px; border: 1px solid var(--border-color); border-radius: 26px; background: var(--card-bg); color: var(--text-primary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.flash-card.flipped { background: var(--user-accent, #000); color: #fff; border-color: transparent; }
.flash-side { font: 600 22px 'Poppins', sans-serif; line-height: 1.35; overflow-wrap: anywhere; }
.flash-hint { font-size: 12px; opacity: .6; }
body.book-open { overflow: hidden; }
#book-overlay { position: fixed; inset: 0; z-index: 99990; display: flex; flex-direction: column; background: var(--book-bg, #fbf8f1); color: var(--book-text, #2b2620); opacity: 0; transition: opacity .25s ease; height: calc(var(--app-vh, 1vh) * 100); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
#book-overlay.open { opacity: 1; }
.book-top, .book-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; }
.book-title { flex: 1; text-align: center; font: 600 13px 'Poppins', sans-serif; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-tools { display: flex; gap: 6px; }
.book-btn { min-width: 44px; min-height: 44px; border: 0; border-radius: 9999px; background: color-mix(in srgb, var(--book-text, #000) 8%, transparent); color: inherit; font: 600 14px 'Poppins', sans-serif; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.book-btn:disabled { opacity: .3; }
.book-progress { height: 3px; margin: 0 14px; background: color-mix(in srgb, var(--book-text, #000) 10%, transparent); border-radius: 3px; overflow: hidden; }
.book-progress-fill { height: 100%; background: var(--book-text, #000); transition: width .25s ease; }
.book-stage { flex: 1; min-height: 0; display: flex; justify-content: center; overflow: hidden; touch-action: pan-y; }
.book-page { width: 100%; max-width: 560px; padding: 28px 28px 20px; overflow-y: auto; font-family: 'Playfair Display', Georgia, serif; line-height: 1.7; }
.book-page p { margin: 0 0 .9em; text-indent: 1.4em; text-align: justify; hyphens: auto; }
.book-page p.cont, .book-page h2 + p { text-indent: 0; }
.book-page h2 { font-size: 1.5em; margin: .4em 0 .8em; line-height: 1.25; }
.book-page.turn-next { animation: bookNext .28s ease; }
.book-page.turn-prev { animation: bookPrev .28s ease; }
@keyframes bookNext { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes bookPrev { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
.book-cover { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; }
.book-cover h1 { font-size: 2em; line-height: 1.2; overflow-wrap: anywhere; }
.book-cover-rule { width: 56px; height: 2px; background: currentColor; opacity: .5; }
.book-cover p { font: 500 13px 'Poppins', sans-serif; opacity: .6; text-indent: 0; }
.book-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.book-count { font: 600 12px 'Poppins', sans-serif; opacity: .7; }
.book-themes { display: flex; gap: 8px; }
.book-theme { width: 40px; height: 32px; border-radius: 10px; border: 2px solid transparent; font: 600 12px 'Playfair Display', serif; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(128,128,128,.35); }
.book-theme.active { border-color: var(--user-accent, #0a84ff); }
@media (prefers-reduced-motion: reduce) { .book-page.turn-next, .book-page.turn-prev { animation: none; } }
