/* ══ Article Reading Modal ══ */

#article-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 8, 20, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 998;
}
#article-overlay.on { opacity: 1; pointer-events: all; }

#article-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  max-width: 720px; margin: 0 auto;
  background: rgba(12, 10, 24, 0.96);
  display: flex; flex-direction: column;
  z-index: 999;
  opacity: 0;
  transform: translateY(24px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (min-width: 720px) {
  #article-modal {
    top: max(env(safe-area-inset-top), 40px);
    bottom: 40px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(0,0,0,0.55);
  }
}
#article-modal.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Top Bar ── */
#article-topbar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 12px;
  padding: max(env(safe-area-inset-top), 16px) 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(to bottom, rgba(12,10,24,0.98), rgba(12,10,24,0.92));
}

#article-close-btn, #article-font-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 38px; height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-size: 14px; font-weight: 600;
  transition: background 0.2s, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}
#article-close-btn:active, #article-font-btn:active {
  background: rgba(255,255,255,0.12);
  transform: scale(0.92);
  transition: transform 0.1s, background 0.1s;
}

#article-meta {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono);
  font-size: 11px; font-weight: 300;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.art-meta-time { font-weight: 500; }
.art-meta-sep { opacity: 0.4; }
.art-meta-targets { font-weight: 500; }

/* ── Content area ── */
#article-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px 24px max(env(safe-area-inset-bottom), 48px);
  -webkit-overflow-scrolling: touch;
  --art-font-scale: 1;
  --art-accent: #c6a84b;
}
#article-content::-webkit-scrollbar { width: 3px; }
#article-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
@media (max-width: 599px) {
  #article-content { scrollbar-width: none; }
  #article-content::-webkit-scrollbar { display: none; }
}

.art-body {
  max-width: 640px;
  margin: 0 auto;
}

.art-title {
  font-family: var(--serif);
  font-size: calc(28px * var(--art-font-scale));
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0 0 8px;
}
.art-title-zh {
  font-family: var(--serif);
  font-size: calc(14px * var(--art-font-scale));
  font-weight: 300;
  line-height: 1.3;
  color: var(--text-tertiary);
  margin: 0 0 28px;
}

.art-text {
  font-family: 'Georgia', 'Lora', var(--serif);
  font-size: calc(17px * var(--art-font-scale));
  font-weight: 400;
  line-height: 1.75;
  color: rgba(255,255,255,0.88);
  letter-spacing: 0.005em;
}
.art-text br + br { content: ''; display: block; margin-top: 0.6em; }

/* ── Target word highlight ── */
.art-target {
  color: var(--art-accent);
  font-weight: 500;
  border-bottom: 1.5px dashed var(--art-accent);
  padding: 0 1px 1px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.art-target:hover {
  background: rgba(198, 168, 75, 0.08);
}
.art-target.tapped {
  border-bottom-style: solid;
  background: rgba(198, 168, 75, 0.06);
}

/* ── Tooltip ── */
#article-tooltip {
  position: fixed;
  z-index: 1001;
  min-width: 180px;
  max-width: 280px;
  padding: 12px 14px;
  background: rgba(20, 16, 32, 0.98);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  opacity: 0;
  transform: translateY(4px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
#article-tooltip.on {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.art-tip-head {
  font-family: var(--mono);
  font-size: 13px; font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.art-tip-zh {
  font-family: var(--sans);
  font-size: 13px; font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.art-tip-formula {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.4;
  margin-bottom: 6px;
}
.art-tip-hint {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  opacity: 0.6;
}

/* ── Footer: progress + done button ── */
.art-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.art-progress {
  height: 2px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 18px;
}
.art-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.25s ease;
}
.art-done-btn {
  display: block;
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.art-done-btn:not(:disabled) {
  background: var(--art-accent);
  color: #0a0816;
  border-color: var(--art-accent);
  box-shadow: 0 0 20px color-mix(in srgb, var(--art-accent) 30%, transparent);
}
.art-done-btn:disabled { cursor: not-allowed; }
.art-done-btn:not(:disabled):active {
  transform: scale(0.98);
}

/* ── Summary unlock card (shown in energy-summary) ── */
.article-unlock-card {
  margin-top: 20px;
  padding: 16px 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-tap-highlight-color: transparent;
}
.article-unlock-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
}
.article-unlock-card:active { transform: scale(0.985); }
.art-unlock-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: rgba(198, 168, 75, 0.12);
  color: #e8c96a;
}
.art-unlock-body {
  flex: 1; min-width: 0;
  text-align: left;
}
.art-unlock-title {
  font-family: var(--sans);
  font-size: 14px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.art-unlock-meta {
  font-family: var(--mono);
  font-size: 11px; font-weight: 300;
  color: var(--text-tertiary);
  letter-spacing: 0.03em;
}
.art-unlock-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.25s, color 0.25s;
}
.article-unlock-card:hover .art-unlock-arrow {
  transform: translateX(3px);
  color: var(--text-tertiary);
}

/* ── Article Prompt Dialog ── */
#article-prompt-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 8, 20, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1010;
}
#article-prompt-overlay.on { opacity: 1; pointer-events: all; }

#article-prompt {
  position: fixed;
  left: 50%; bottom: 0;
  transform: translateX(-50%) translateY(100%);
  width: min(480px, 100%);
  background: rgba(16, 12, 30, 0.98);
  border-radius: 24px 24px 0 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-bottom: none;
  padding: 32px 28px max(env(safe-area-inset-bottom), 32px);
  z-index: 1011;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.25s ease;
  text-align: center;
}
#article-prompt.open {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: all;
}
@media (min-width: 600px) {
  #article-prompt {
    bottom: auto;
    top: 50%; left: 50%;
    transform: translate(-50%, -40%) scale(0.96);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  }
  #article-prompt.open {
    transform: translate(-50%, -50%) scale(1);
  }
}

#article-prompt-icon {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 16px;
}
#article-prompt-title {
  font-family: var(--serif);
  font-size: 20px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}
#article-prompt-body {
  font-family: var(--sans);
  font-size: 14px; font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 10px;
}
#article-prompt-meta {
  font-family: var(--mono);
  font-size: 11px; font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 28px;
}
#article-prompt-actions {
  display: flex; flex-direction: column; gap: 10px;
}
#article-prompt-confirm {
  width: 100%; padding: 14px 16px;
  background: var(--art-accent, #c6a84b);
  color: #0a0816;
  border: none; border-radius: 12px;
  font-family: var(--mono);
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 0 12px color-mix(in srgb, var(--art-accent, #c6a84b) 30%, transparent);
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}
#article-prompt-confirm:active { transform: scale(0.97); }
#article-prompt-cancel {
  width: 100%; padding: 12px 16px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px; font-weight: 400;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
#article-prompt-cancel:hover { background: rgba(255,255,255,0.05); color: var(--text-tertiary); }
