/* PWA 安装提示条：学习完成后出现，移动端避让全局底部导航。 */
.ct-pwa-install-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 1080;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-left: 3px solid #1f6feb;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(12px);
  color: #1f2937;
  font-size: 14px;
  line-height: 1.4;
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
  animation: ct-pwa-banner-in 220ms ease-out both;
}

.ct-pwa-install-banner__visual {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  background: #eef5ff;
  box-shadow: 0 4px 12px rgba(31, 111, 235, 0.16);
  overflow: hidden;
}

.ct-pwa-install-banner__visual img {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: cover;
}

.ct-pwa-install-banner__text {
  flex: 1;
  min-width: 0;
}

.ct-pwa-install-banner__text strong,
.ct-pwa-install-banner__text span {
  display: block;
  letter-spacing: 0;
}

.ct-pwa-install-banner__text strong {
  color: #172033;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}

.ct-pwa-install-banner__text span {
  margin-top: 2px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.ct-pwa-install-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ct-pwa-install-banner__actions:empty {
  display: none;
}

.ct-pwa-install-banner__btn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 13px;
  min-height: 40px;
  background: #0d6efd;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 6px 14px rgba(13, 110, 253, 0.22);
  transition: background-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.ct-pwa-install-banner__btn:hover {
  background: #0b5ed7;
  box-shadow: 0 8px 18px rgba(13, 110, 253, 0.28);
  transform: translateY(-1px);
}

.ct-pwa-install-banner__btn:focus-visible,
.ct-pwa-install-banner__dismiss:focus-visible {
  outline: 2px solid rgba(13, 110, 253, 0.4);
  outline-offset: 2px;
}

.ct-pwa-install-banner__btn:active {
  opacity: 0.9;
}

.ct-pwa-install-banner__dismiss {
  appearance: none;
  border: 0;
  background: transparent;
  color: #6b7280;
  font-size: 15px;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 150ms ease, color 150ms ease;
}

.ct-pwa-install-banner__dismiss:hover {
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
}

@keyframes ct-pwa-banner-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 1181px) {
  .ct-pwa-install-banner {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 420px;
    margin: 0;
  }
}

@media (max-width: 1180px) {
  .ct-pwa-install-banner--above-nav {
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 640px) {
  .ct-pwa-install-banner {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 36px;
    align-items: start;
    column-gap: 10px;
    row-gap: 8px;
  }

  .ct-pwa-install-banner__visual {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .ct-pwa-install-banner__text {
    grid-column: 2;
    grid-row: 1;
  }

  .ct-pwa-install-banner__actions {
    grid-column: 2;
    grid-row: 2;
    justify-content: flex-start;
  }

  .ct-pwa-install-banner__dismiss {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ct-pwa-install-banner {
    animation: none;
  }

  .ct-pwa-install-banner__btn,
  .ct-pwa-install-banner__dismiss {
    transition: none;
  }
}

@media (max-width: 768px) {
  .ct-pwa-install-banner--above-nav {
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }
}

/* Settings: explicit entry point for PWA / home-screen installation. */
.ct-settings-pwa__summary {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 14px;
}

.ct-settings-pwa__summary strong {
  display: block;
  color: #172033;
  font-size: 15px;
  line-height: 1.3;
}

.ct-settings-pwa__icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #c9ddfa;
  border-radius: 8px;
  color: #1769e0;
  background: #eef6ff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.ct-settings-pwa__action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid #e7edf5;
  border-bottom: 1px solid #e7edf5;
}

.ct-settings-pwa__action-row .btn {
  min-height: 38px;
  padding-inline: 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(13, 110, 253, 0.16);
}

.ct-settings-pwa__status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 7px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.ct-settings-pwa__status:empty {
  display: none;
}

.ct-settings-pwa__reminder {
  margin-bottom: 0;
}

.ct-settings-pwa__reminder .form-check-label {
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.ct-settings-pwa__reminder + .form-text {
  margin-left: 30px;
}

.ct-pwa-install-help {
  position: fixed;
  z-index: 1090;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: min(420px, calc(100% - 24px));
  padding: 16px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
  transform: translateX(-50%);
}

.ct-pwa-install-help__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #172033;
  font-weight: 700;
}

.ct-pwa-install-help__body {
  margin: 10px 0 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.7;
}

.ct-pwa-install-help__close {
  appearance: none;
  border: 0;
  padding: 4px;
  color: #64748b;
  background: transparent;
  cursor: pointer;
}

html[data-theme="dark"] .ct-settings-pwa__summary strong {
  color: #e5edf8;
}

html[data-theme="dark"] .ct-settings-pwa__icon {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(37, 99, 235, 0.16);
  color: #93c5fd;
  box-shadow: none;
}

html[data-theme="dark"] .ct-settings-pwa__action-row {
  border-color: rgba(255, 255, 255, 0.1);
}

html[data-theme="dark"] .ct-settings-pwa__status {
  background: rgba(148, 163, 184, 0.13);
  color: #cbd5e1;
}

html[data-theme="dark"] .ct-settings-pwa__reminder .form-check-label {
  color: #dbeafe;
}

@media (max-width: 480px) {
  .ct-settings-pwa__action-row {
    align-items: stretch;
  }

  .ct-settings-pwa__action-row .btn {
    width: 100%;
  }

  .ct-settings-pwa__status {
    width: 100%;
  }
}
