/* ── Guide page ────────────────────────────────────────────────────────────── */

.guide-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
    min-height: calc(100vh - 200px);
}

/* Loading / error / empty share the existing tips spinner styles */
.guide-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    color: var(--color-muted);
    padding: 5rem 1rem;
}

.guide-error {
    padding: 4rem 1rem;
    text-align: center;
    color: #ff6b6b;
}

.guide-empty {
    text-align: center;
    padding: 5rem 1rem 4rem;
}
.guide-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}
.guide-empty h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}
.guide-empty p {
    color: var(--color-muted);
    margin-bottom: 1.5rem;
}
.guide-cta {
    display: inline-block;
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: none;
}
.guide-cta:hover { text-decoration: underline; }

/* ── Chapter list ──────────────────────────────────────────────────────────── */

.guide-intro h1 {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 0.6rem;
}
.guide-intro p {
    color: var(--color-muted);
    font-size: 1.05rem;
    margin-bottom: 2.25rem;
    max-width: 560px;
}

.guide-chapters {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* Chapter card: container that wraps the chapter header + nested sections */
.guide-chapter-card {
    background: var(--color-surface);
    border: 1px solid #222;
    border-radius: 14px;
    color: inherit;
    overflow: hidden;
    transition: border-color 0.15s;
}
.guide-chapter-card:hover {
    border-color: #333;
}

.guide-chapter-card.complete {
    border-color: rgba(78, 205, 196, 0.4);
    background: rgba(78, 205, 196, 0.05);
}

/* Chapter header — clickable button. Opens at first unseen content tip. */
.guide-chapter-header {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding: 1.25rem 1.4rem;
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: background 0.15s;
}
.guide-chapter-header:hover { background: #1a1a1a; }
.guide-chapter-card.complete .guide-chapter-header:hover { background: rgba(78, 205, 196, 0.08); }

/* Section list — sub-items showing each lesson in the chapter */
.guide-section-list {
    border-top: 1px solid #222;
    display: flex;
    flex-direction: column;
}

.guide-section-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1.4rem 0.7rem 4rem;   /* left padding aligns with chapter title */
    background: transparent;
    border: none;
    border-top: 1px solid #1a1a1a;
    color: inherit;
    font: inherit;
    text-align: left;
    width: 100%;
    cursor: pointer;
    transition: background 0.15s;
}
.guide-section-row:first-child { border-top: none; }
.guide-section-row:hover { background: #1a1a1a; }
.guide-chapter-card.complete .guide-section-row:hover { background: rgba(78, 205, 196, 0.08); }

.guide-section-name {
    font-size: 0.92rem;
    color: var(--color-text);
    flex: 1;
    min-width: 0;
}

.guide-section-count {
    font-size: 0.78rem;
    color: var(--color-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.guide-section-row.complete .guide-section-count {
    color: var(--color-accent);
    font-weight: 600;
}

@media (max-width: 600px) {
    .guide-chapter-header { padding: 1rem 1.1rem; gap: 0.85rem; }
    .guide-section-row { padding: 0.65rem 1.1rem 0.65rem 3rem; }
}

.guide-chapter-num {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #1c1c1c;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.guide-chapter-card.complete .guide-chapter-num {
    background: var(--color-accent);
    color: #001a1a;
}

.guide-chapter-text {
    flex: 1;
    min-width: 0;
}

.guide-chapter-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.guide-chapter-meta {
    font-size: 0.82rem;
    color: var(--color-muted);
}

/* Progress ring on each chapter card */
.guide-chapter-ring {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    transform: rotate(-90deg);
}
.guide-chapter-ring circle {
    fill: none;
    stroke-width: 3;
}
.guide-chapter-ring circle.bg { stroke: #2a2a2a; }
.guide-chapter-ring circle.fg {
    stroke: var(--color-accent);
    transition: stroke-dashoffset 0.4s ease-out;
}

/* Overall progress footer */
.guide-overall-progress {
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    background: var(--color-surface);
    border-radius: 12px;
    color: var(--color-muted);
    font-size: 0.92rem;
    text-align: center;
}

/* ── Reader ────────────────────────────────────────────────────────────────── */

.guide-reader-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.reader-back {
    background: none;
    border: none;
    color: var(--color-accent);
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 4px 0;
}
.reader-back:hover { opacity: 0.85; }

.reader-chapter-title {
    flex: 1;
    font-size: 0.85rem;
    color: var(--color-muted);
    text-align: right;
    font-weight: 500;
}

/* Segmented progress bar — one segment per content tip, gaps between sections */
.reader-progress {
    display: flex;
    gap: 4px;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}
.reader-progress-segment {
    flex: 1;
    height: 4px;
    background: #2a2a2a;
    border-radius: 999px;
    min-width: 12px;
    transition: background 0.2s;
}
.reader-progress-segment.seen { background: var(--color-accent); }
.reader-progress-segment.current {
    background: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(78, 205, 196, 0.25);
}
.reader-progress-section-break {
    width: 12px;
    flex: none;
}

/* Article */
.reader-section-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.6rem;
}

#reader-title {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.85rem;
}

.reader-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}
.reader-tags .reader-tag {
    font-size: 0.78rem;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 999px;
}

.reader-body {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text);
}
.reader-body p { margin-bottom: 0.95rem; }
.reader-body h1, .reader-body h2, .reader-body h3 {
    font-weight: 600;
    margin: 1.4rem 0 0.55rem;
    letter-spacing: -0.01em;
}
.reader-body ul, .reader-body ol {
    padding-left: 1.4rem;
    margin-bottom: 0.95rem;
}
.reader-body li { margin-bottom: 0.4rem; }
.reader-body strong { font-weight: 600; }
.reader-body em { font-style: italic; }
.reader-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 0.75rem 0;
    display: block;
}
.reader-body a { color: var(--color-accent); text-decoration: none; }
.reader-body a:hover { text-decoration: underline; }

.reader-deep-dive {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #222;
    font-size: 1rem;
    line-height: 1.7;
}
.reader-deep-dive p { margin-bottom: 0.95rem; }
.reader-deep-dive ul, .reader-deep-dive ol { padding-left: 1.4rem; margin-bottom: 0.95rem; }
.reader-deep-dive li { margin-bottom: 0.4rem; }
.reader-deep-dive strong { font-weight: 600; }
.reader-deep-dive em { font-style: italic; }
.reader-deep-dive img { max-width: 100%; border-radius: 8px; margin: 0.5rem 0; display: block; }
.reader-deep-dive a { color: var(--color-accent); text-decoration: none; }

/* Controls */
.reader-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #1e1e1e;
}

.reader-nav-btn {
    background: var(--color-surface);
    border: 1px solid #2e2e2e;
    border-radius: 10px;
    color: var(--color-text);
    padding: 0.6rem 1rem;
    cursor: pointer;
    font: inherit;
    font-size: 0.92rem;
    transition: background 0.15s, opacity 0.15s;
}
.reader-nav-btn:hover:not(:disabled) { background: #222; }
.reader-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.reader-mark-seen {
    background: var(--color-accent);
    color: #001a1a;
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1.25rem;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.15s;
}
.reader-mark-seen:hover { background: var(--color-accent-hover); }
.reader-mark-seen.seen {
    background: rgba(78, 205, 196, 0.15);
    color: var(--color-accent);
}
.reader-mark-seen.seen::before { content: "✓ "; }

/* ── Completion sheet ──────────────────────────────────────────────────────── */

.guide-complete {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.guide-complete-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.guide-complete-content {
    position: relative;
    background: var(--color-surface);
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    padding: 2.5rem 2rem 2rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: profile-in 0.2s ease-out;
}
.guide-complete-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}
.guide-complete-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}
.guide-complete-content p {
    color: var(--color-muted);
    margin-bottom: 0.6rem;
    line-height: 1.55;
}
.guide-complete-hint {
    font-size: 0.88rem;
}
.guide-complete-actions {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

/* Same button styles as the profile modal (kept local so guide.css is self-contained) */
.profile-btn {
    padding: 0.7rem 1.4rem;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    border: 1.5px solid transparent;
    text-decoration: none;
    display: inline-block;
}
.profile-btn-ghost {
    background: transparent;
    color: var(--color-muted);
    border-color: #333;
}
.profile-btn-ghost:hover {
    color: var(--color-text);
    border-color: #555;
}
.profile-btn-primary {
    background: var(--color-accent);
    color: #001a1a;
}
.profile-btn-primary:hover {
    background: var(--color-accent-hover);
}

/* Reused profile-modal entrance animation */
@keyframes profile-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Reused spinner */
.tips-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #222;
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* Reused dive deeper button */
.dive-deeper-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--color-accent);
    background: rgba(78, 205, 196, 0.08);
    border: 1px solid rgba(78, 205, 196, 0.2);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    cursor: pointer;
    font-family: inherit;
    margin-top: 1.25rem;
    transition: background 0.15s;
}
.dive-deeper-btn:hover { background: rgba(78, 205, 196, 0.15); }
.dive-deeper-btn .dive-arrow {
    transition: transform 0.2s;
    display: inline-block;
}
.dive-deeper-btn.open .dive-arrow { transform: rotate(90deg); }

/* ── Mobile ────────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .guide-page { padding: 1.5rem 1rem 3rem; }
    .guide-intro h1 { font-size: 1.9rem; }
    #reader-title { font-size: 1.45rem; }
    .reader-controls { flex-wrap: wrap; }
    .reader-mark-seen { order: -1; flex: 1 1 100%; }
}
