/* CandyUI — Notify / Confirm / Overlay / Hint tokens */

:root {
  --candy-ui-success: #20bf20;
  --candy-ui-error: #ff3f3f;
  --candy-ui-notice: #ff9800;
  --candy-ui-info: rgba(0, 0, 0, 0.72);
  --candy-ui-hint-bg: rgba(30, 30, 30, 0.88);
  --candy-ui-hint-fg: #fff;
  --candy-ui-z-notify: 10040;
  --candy-ui-z-overlay: 10030;
  --candy-ui-z-confirm: 10060;
  --candy-ui-z-hint: 22;
  --candy-ui-radius: 8px;
  --candy-ui-shadow: 1px 1px 15px rgba(0, 0, 0, 0.15);
}

/* —— Notify —— */
.notify-container {
  position: fixed;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end; /* 评论成功等：右下角 */
  justify-content: flex-start; /* column-reverse → 贴底 */
  width: 100%;
  max-width: 100vw;
  inset: 0;
  height: auto;
  min-height: 100%;
  min-height: 100dvh;
  min-height: var(--candy-vh, 100dvh);
  max-height: none;
  padding: 0 20px calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: var(--candy-ui-z-notify);
  pointer-events: none;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  box-sizing: border-box;
  overflow: visible;
}

.notify-container .notify {
  pointer-events: auto;
  background-color: var(--candy-ui-success);
  border-right: 7px solid rgba(0, 0, 0, 0.4);
  transition: opacity 0.28s ease, transform 0.28s ease, margin 0.35s ease;
  color: #fff;
  box-shadow: var(--candy-ui-shadow);
  margin: 12px 0 0;
  padding: 10px 16px;
  border-radius: 8px;
  max-width: min(420px, calc(100vw - 40px));
  width: max-content;
  animation: candy-notify-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  cursor: pointer;
  text-align: left;
}

.notify-container .notify.is-success {
  background-color: var(--candy-ui-success);
}

.notify-container .notify.is-error {
  background-color: var(--candy-ui-error);
}

.notify-container .notify.is-notice {
  background-color: var(--candy-ui-notice);
}

/* 门户欢迎等 info：仍顶部居中（独立定位，不受右下角容器影响） */
.notify-container .notify.is-info {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 50%;
  right: auto;
  bottom: auto;
  margin: 0;
  transform: translateX(-50%);
  background-color: var(--candy-ui-info);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  padding: 12px 18px;
  animation: candy-notify-info-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

body:not(.on-index) .notify-container .notify.is-info {
  top: calc(56px + env(safe-area-inset-top, 0px));
}

.notify-container .notify.is-leaving {
  opacity: 0;
  transform: translateX(12px);
}

.notify-container .notify.is-info.is-leaving {
  transform: translateX(-50%) translateY(-10px);
}

.notify-container .notify .title {
  font-size: 1.05rem;
  line-height: 1.35;
}

.notify-container .notify .content {
  color: #eaeaea;
  font-size: 0.9rem;
  line-height: 1.45;
}

.notify-container .notify .title + .content {
  margin-top: 4px;
}

.notify-container .notify.is-info .content {
  color: #fff;
  font-size: 0.95rem;
}

.notify-container .notify .content strong,
.notify-container .notify .content b {
  color: #fff;
  font-weight: 700;
}

@keyframes candy-notify-in {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes candy-notify-info-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-14px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 768px) {
  .notify-container {
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  body:not(.on-index) .notify-container .notify.is-info {
    top: calc(52px + env(safe-area-inset-top, 0px));
  }

  .notify-container .notify {
    max-width: calc(100vw - 24px);
    width: auto;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.92rem;
  }

  .notify-container .notify.is-info {
    padding: 11px 16px;
    max-width: min(360px, calc(100vw - 24px));
  }

  .notify-container .notify.is-info .content {
    font-size: 0.92rem;
    line-height: 1.4;
  }

  .notify-container .notify .title {
    font-size: 1rem;
  }
}

/* —— Confirm —— */
.candy-confirm-mask {
  position: fixed;
  inset: 0;
  z-index: var(--candy-ui-z-confirm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 20px;
  box-sizing: border-box;
}

.candy-confirm-mask[hidden] {
  display: none !important;
}

.candy-confirm-dialog {
  width: min(400px, 100%);
  background: #fff;
  color: #111827;
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.candy-confirm-title {
  padding: 16px 18px 8px;
  font-size: 17px;
  font-weight: 700;
}

.candy-confirm-body {
  padding: 4px 18px 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #4b5563;
}

.candy-confirm-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 18px 16px;
  border-top: 1px solid #e5e7eb;
}

.candy-confirm-btn {
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
}

.candy-confirm-btn.candy-confirm-ok.is-danger {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

.candy-confirm-btn.candy-confirm-ok:not(.is-danger) {
  background: var(--candy-accent, #8172ef);
  border-color: var(--candy-accent, #8172ef);
  color: #fff;
}

body.candy-confirm-open,
body.candy-overlay-lock {
  overflow: hidden;
}

/* —— Overlay shell markers —— */
.candy-overlay,
.search-overlay,
.link-popup-backdrop {
  /* z-index kept by existing rules; marker for shared ESC/lock */
}

/* —— Hint / Dock tip tokens —— */
.candy-hint,
.candy-dock-tip {
  color: var(--candy-ui-hint-fg);
  background: var(--candy-ui-hint-bg);
  border-radius: var(--candy-ui-radius);
  font-size: 12px;
  line-height: 1.2;
  pointer-events: none;
  z-index: var(--candy-ui-z-hint);
}

.home-enter-hint.candy-hint,
#home-enter-hint.candy-hint {
  pointer-events: auto;
  background: transparent;
  font-size: 0.92rem;
  z-index: var(--candy-ui-z-hint);
}

.open-capsule.candy-hint {
  pointer-events: auto;
  background: #00000026;
  font-size: 0.95rem;
  color: #efefef;
}

@media (prefers-color-scheme: dark) {
  .candy-confirm-dialog {
    background: #0f172a;
    color: #e5e7eb;
  }
  .candy-confirm-body {
    color: #9ca3af;
  }
  .candy-confirm-footer {
    border-top-color: #1f2937;
  }
  .candy-confirm-btn {
    background: #1e293b;
    border-color: #334155;
    color: #e5e7eb;
  }
}

body.reading-mode .candy-confirm-dialog,
html.reading-mode .candy-confirm-dialog {
  background: #1c1c28;
  color: #e8e6f2;
}
body.reading-mode .candy-confirm-body,
html.reading-mode .candy-confirm-body {
  color: rgba(232, 230, 242, 0.65);
}
body.reading-mode .candy-confirm-footer,
html.reading-mode .candy-confirm-footer {
  border-top-color: rgba(255, 255, 255, 0.1);
}
body.reading-mode .candy-confirm-btn,
html.reading-mode .candy-confirm-btn {
  background: #2a2a3a;
  border-color: rgba(255, 255, 255, 0.14);
  color: #e8e6f2;
}

.candy-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100000;
  padding: 8px 16px;
  background: #111;
  color: #fff;
}
.candy-skip-link:focus {
  left: 12px;
  top: 12px;
}
.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}
.article-list a.bean-article {
  text-decoration: none;
  color: inherit;
}
.article-list .bean-article-permalink {
  position: absolute;
  inset: 0;
  z-index: 1;
  color: transparent;
  font-size: 0;
  text-decoration: none;
}
.candy-pagination-fallback {
  display: block;
  padding: 16px 40px 24px;
  color: #fff;
}
