/* Keyline Days — runtime performance layer (additive, safe overrides). */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button,
[role="button"],
a,
input,
select,
textarea,
.category-pill,
.desktop-nav-item,
.tab-picker-item {
  touch-action: manipulation;
}

.list-container:not(#countdownList):not(#festivalList) {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.content,
.list-container,
.calendar-detail-body,
.settings-panel,
.tab-picker-panel,
.backup-panel,
.emoji-panel,
.desktop-nav {
  overscroll-behavior: contain;
}

html.kd-is-scrolling .count-card,
html.kd-is-scrolling .checklist-card,
html.kd-is-scrolling .festival-card,
html.kd-is-scrolling .subscription-card,
html.kd-is-scrolling .overview-card,
html.kd-is-scrolling .timeline-card,
html.kd-is-scrolling .grade-course-card,
html.kd-is-scrolling .accounting-card,
html.kd-is-scrolling .teacher-review-card,
html.kd-is-scrolling .course-tool-card,
html.kd-is-scrolling .translation-library-card,
html.kd-is-scrolling .translation-practice-card,
html.kd-is-scrolling .goal-mobile-card,
html.kd-is-scrolling .settings-item,
html.kd-is-scrolling .tab-picker-item,
html.kd-is-scrolling .calendar-day,
html.kd-is-scrolling .category-pill,
html.kd-is-scrolling .schedule-mode-btn {
  transition-duration: 0ms !important;
  animation-play-state: paused !important;
}

@media (hover: none) {
  .count-card:hover,
  .checklist-card:hover,
  .festival-card:hover,
  .subscription-card:hover,
  .overview-card:hover,
  .timeline-card:hover,
  .grade-course-card:hover,
  .teacher-review-card:hover,
  .course-tool-card:hover,
  .translation-library-card:hover,
  .translation-practice-card:hover,
  .goal-mobile-card:hover,
  .desktop-nav-item:hover,
  .category-pill:hover,
  .settings-item:hover,
  .tab-picker-item:hover {
    transform: none !important;
    filter: none !important;
  }

  .kd-touch-pulse {
    display: none !important;
  }
}

.theme-mono .count-card,
.theme-mono .checklist-card,
.theme-mono .festival-card,
.theme-mono .subscription-card,
.theme-mono .overview-card,
.theme-mono .dashboard-card,
.theme-mono .today-pill,
.theme-mono .compact-today-card {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Animations are disabled in theme-mono; keep cards fully visible. */
.theme-mono .count-card,
.theme-mono .checklist-card,
.theme-mono .festival-card,
.theme-mono .subscription-card,
.theme-mono .overview-card,
.theme-mono .timeline-card,
.theme-mono .grade-course-card,
.theme-mono .accounting-card,
.theme-mono .teacher-review-card,
.theme-mono .subscription-card.kd-item-enter,
.theme-mono .count-card.kd-item-enter,
.theme-mono .checklist-card.kd-item-enter,
.theme-mono .festival-card.kd-item-enter,
.theme-mono .kd-item-enter,
.theme-mono .kd-will-animate,
.theme-mono .kd-enter,
.theme-mono .tab-panel-animate {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .count-card,
  .checklist-card,
  .festival-card,
  .subscription-card,
  .overview-card,
  .kd-item-enter,
  .kd-will-animate,
  .kd-enter,
  .tab-panel-animate {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.kd-stable-render-root .kd-item-enter,
.kd-stable-render-root .kd-enter,
.kd-stable-render-root [data-kd-enter] {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}
.kd-no-enter .kd-item-enter,
.kd-no-enter .kd-enter,
.kd-no-enter [data-kd-enter] {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}

/* Festival list hardening: keep emoji cards stable during scrolling */
#festivalList,
#festivalList.festival-list-stable,
#festivalList.kd-stable-render-root {
  contain: none !important;
  content-visibility: visible !important;
  overflow-anchor: none;
}
#festivalList .festival-card {
  opacity: 1 !important;
  visibility: visible !important;
}
#festivalList .festival-card,
#festivalList .festival-card *,
#festivalList .festival-icon-box,
#festivalList .festival-icon,
#festivalList .festival-emoji {
  opacity: 1 !important;
  visibility: visible !important;
  animation: none !important;
  content-visibility: visible !important;
}
#festivalList .festival-card,
#festivalList .festival-icon-box,
#festivalList .festival-icon,
#festivalList .festival-emoji {
  transform: none !important;
  filter: none !important;
}
#festivalList .festival-icon-box {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
#festivalList .festival-emoji {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  color: initial;
}

/* Countdown page hardening: avoid scroll-time compositor flicker */
.countdown-page-stable,
.countdown-list-stable,
#countdownList,
.countdown-list,
[data-kd-stable-list="countdown"] {
  contain: none !important;
  content-visibility: visible !important;
  will-change: auto !important;
  overflow-anchor: none;
  transform: none !important;
  filter: none !important;
}
.countdown-page-stable *,
.countdown-list-stable *,
#countdownList *,
.countdown-list *,
[data-kd-stable-list="countdown"] * {
  content-visibility: visible !important;
}
.countdown-card,
.count-card,
.countdown-list-stable .countdown-card,
.countdown-list-stable .count-card,
#countdownList .countdown-card,
#countdownList .count-card,
.countdown-list .countdown-card,
.countdown-list .count-card,
[data-kd-stable-list="countdown"] .countdown-card,
[data-kd-stable-list="countdown"] .count-card {
  opacity: 1 !important;
  visibility: visible !important;
  animation: none !important;
  will-change: auto !important;
  contain: none !important;
  content-visibility: visible !important;
}
.countdown-icon-box,
.count-icon-box,
.countdown-icon,
.count-icon,
.countdown-list-stable .kd-line-icon,
.countdown-list-stable .kd-line-icon-svg,
.countdown-list-stable svg,
#countdownList .kd-line-icon,
#countdownList .kd-line-icon-svg,
#countdownList svg,
#countdownList .count-icon-box,
#countdownList .count-icon,
.countdown-list svg {
  opacity: 1 !important;
  visibility: visible !important;
  animation: none !important;
  transform: none !important;
  filter: none !important;
  content-visibility: visible !important;
  display: block !important;
  flex: 0 0 auto !important;
}
.countdown-card,
.count-card,
.countdown-icon-box,
.count-icon-box,
.countdown-list-stable .countdown-card,
.countdown-list-stable .count-card,
.countdown-list-stable .countdown-icon-box,
.countdown-list-stable .count-icon-box,
#countdownList .countdown-card,
#countdownList .count-card,
#countdownList .countdown-icon-box,
#countdownList .count-icon-box {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
.countdown-icon-box svg,
.countdown-icon svg,
.count-icon-box svg,
.count-icon svg,
.countdown-list-stable svg,
#countdownList svg,
.countdown-list svg {
  width: 1.35em !important;
  height: 1.35em !important;
  min-width: 1.35em !important;
  min-height: 1.35em !important;
  max-width: 1.35em !important;
  max-height: 1.35em !important;
}
#countdownList .count-icon-box,
.countdown-list-stable .count-icon-box,
[data-kd-stable-list="countdown"] .count-icon-box {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  line-height: 1 !important;
  text-align: center !important;
  overflow: hidden !important;
}
#countdownList .count-icon-emoji,
.countdown-list-stable .count-icon-emoji,
[data-kd-stable-list="countdown"] .count-icon-emoji {
  display: grid !important;
  place-items: center !important;
  width: 1em !important;
  height: 1em !important;
  min-width: 1em !important;
  min-height: 1em !important;
  max-width: 1em !important;
  max-height: 1em !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  text-align: center !important;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif !important;
  transform: none !important;
}
.countdown-sticky-stable,
.countdown-sticky-stable *,
.countdown-page-stable .page-header,
.countdown-page-stable .today-bar,
.countdown-page-stable .category-filter,
.countdown-sticky-stable.header-top,
.countdown-sticky-stable.today-action-row,
#categoryScroll.countdown-sticky-stable,
.header.countdown-sticky-stable,
.header.countdown-sticky-stable .header-top,
.header.countdown-sticky-stable .today-action-row,
.header.countdown-sticky-stable #categoryScroll {
  opacity: 1 !important;
  visibility: visible !important;
  animation: none !important;
  contain: none !important;
  content-visibility: visible !important;
  will-change: auto !important;
  transform: none !important;
  filter: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
#countdownPanel.countdown-page-stable .header,
#countdownPanel.countdown-page-stable ~ .header {
  transform: none !important;
}

/* Remote feature flags (kd-remote-config.js) */
html[data-kd-overview-enabled="false"] [data-feature="overview"],
html[data-kd-countdown-enabled="false"] [data-feature="countdown"],
html[data-kd-schedule-enabled="false"] [data-feature="schedule"],
html[data-kd-checklist-enabled="false"] [data-feature="checklist"],
html[data-kd-calendar-enabled="false"] [data-feature="calendar"],
html[data-kd-festival-enabled="false"] [data-feature="festival"],
html[data-kd-subscriptions-enabled="false"] [data-feature="subscriptions"],
html[data-kd-grades-enabled="false"] [data-feature="grades"],
html[data-kd-teacher-review-enabled="false"] [data-feature="teacherReview"],
html[data-kd-course-tools-enabled="false"] [data-feature="courseTools"],
html[data-kd-course-assistant-enabled="false"] [data-feature="courseAssistant"],
html[data-kd-ielts-practice-enabled="false"] [data-feature="ieltsPractice"],
html[data-kd-goal-archive-enabled="false"] [data-feature="goalArchive"],
html[data-kd-tutorial-enabled="false"] [data-feature="tutorial"],
html[data-kd-share-export-enabled="false"] [data-feature="shareExport"],
html[data-kd-google-drive-enabled="false"] [data-feature="googleDrive"],
html[data-kd-exchange-rate-enabled="false"] [data-feature="exchangeRate"] {
  display: none !important;
}

.kd-announcement-mask {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.kd-announcement-panel {
  width: min(520px, 100%);
  max-height: min(80vh, 640px);
  overflow: auto;
  border-radius: 18px;
  background: #fffaf2;
  border: 1px solid rgba(201, 111, 85, 0.22);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.kd-announcement-header {
  padding: 20px 22px 8px;
}

.kd-announcement-header h2 {
  margin: 0;
  font-size: 20px;
  color: #5a3e2b;
}

.kd-announcement-body {
  padding: 8px 22px 16px;
  color: #3b2f28;
  line-height: 1.6;
}

.kd-announcement-footer {
  padding: 0 22px 20px;
  display: flex;
  justify-content: flex-end;
}

body.kd-announcement-open {
  overflow: hidden;
}

.kd-version-notice {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 1200;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 252, 247, 0.96);
  border: 1px solid rgba(201, 111, 85, 0.24);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  font-size: 14px;
  color: #5a3e2b;
}
