/* ==========================================================
   enhancements.css — New features for Titanic Workshop
   Bound to existing CSS variables in titanic.css
   --primary: #2D3748  --secondary: #14B8A6  --accent: #F18F01
   ========================================================== */

/* Local helpers */
:root {
    --feat-card-bg: #ffffff;
    --feat-card-border: rgba(45, 55, 72, 0.08);
    --feat-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --feat-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
    --feat-radius: 14px;
    --feat-muted: #64748b;
    --feat-bg-soft: #f1f5f9;
}

/* Generic feature section header */
.feat-section {
    padding: 50px 0 30px;
}
.feat-section h3 {
    color: var(--primary-color);
    font-size: 1.7rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.feat-section h3 .feat-badge {
    background: linear-gradient(135deg, var(--secondary-color), #0d9488);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.feat-section .feat-lead {
    color: var(--feat-muted);
    margin-bottom: 25px;
    font-size: 1.05rem;
    max-width: 720px;
}

/* ==========================================================
   1. AI WORKSHOP ASSISTANT
   ========================================================== */
.ai-fab {
    position: fixed;
    bottom: 25px;
    left: 25px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), #0d9488);
    color: white;
    border: none;
    box-shadow: 0 8px 28px rgba(20, 184, 166, 0.45);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.ai-fab:hover {
    transform: scale(1.08) rotate(-4deg);
    box-shadow: 0 12px 38px rgba(20, 184, 166, 0.55);
}
.ai-fab::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(20, 184, 166, 0.35);
    animation: aiPulse 2.4s ease-out infinite;
}
@keyframes aiPulse {
    0%   { transform: scale(0.85); opacity: 0.9; }
    100% { transform: scale(1.5);  opacity: 0; }
}
.ai-fab .ai-fab-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 14px;
    height: 14px;
    background: var(--accent-color);
    border: 2px solid white;
    border-radius: 50%;
}

.ai-panel {
    position: fixed;
    bottom: 100px;
    left: 25px;
    width: 380px;
    max-width: calc(100vw - 50px);
    height: 560px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom left;
    animation: aiPanelIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ai-panel.open { display: flex; }
@keyframes aiPanelIn {
    from { opacity: 0; transform: scale(0.85) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.ai-panel-header {
    background: linear-gradient(135deg, var(--primary-color), #1a202c);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.ai-panel-header .ai-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1.05rem;
}
.ai-panel-header .ai-title .ai-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}
.ai-panel-header .ai-status {
    font-size: 0.7rem;
    opacity: 0.75;
    display: block;
    margin-top: 2px;
    font-weight: 400;
}
.ai-panel-header button {
    background: rgba(255,255,255,0.12);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.2s;
}
.ai-panel-header button:hover { background: rgba(255,255,255,0.25); }

.ai-context-pill {
    background: var(--feat-bg-soft);
    padding: 8px 16px;
    font-size: 0.78rem;
    color: var(--feat-muted);
    border-bottom: 1px solid var(--feat-card-border);
    display: flex;
    align-items: center;
    gap: 6px;
}
.ai-context-pill strong { color: var(--primary-color); }

.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fafbfc;
}
.ai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: msgIn 0.25s ease-out;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ai-msg.ai-msg-bot {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--feat-card-border);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: var(--feat-shadow);
}
.ai-msg.ai-msg-user {
    background: linear-gradient(135deg, var(--secondary-color), #0d9488);
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}
.ai-msg code {
    background: rgba(0,0,0,0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85em;
}
.ai-msg.ai-msg-user code { background: rgba(255,255,255,0.2); }

.ai-typing {
    background: white;
    border: 1px solid var(--feat-card-border);
    border-radius: 14px;
    padding: 12px 16px;
    align-self: flex-start;
    display: inline-flex;
    gap: 4px;
}
.ai-typing span {
    width: 7px;
    height: 7px;
    background: var(--secondary-color);
    border-radius: 50%;
    animation: aiTyping 1.2s ease-in-out infinite;
}
.ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes aiTyping {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-4px); }
}

.ai-suggestions {
    padding: 0 14px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: #fafbfc;
}
.ai-suggestion {
    background: white;
    border: 1px solid var(--feat-card-border);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}
.ai-suggestion:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
    transform: translateY(-1px);
}

.ai-input-row {
    padding: 12px;
    background: white;
    border-top: 1px solid var(--feat-card-border);
    display: flex;
    gap: 8px;
}
.ai-input-row input {
    flex: 1;
    border: 1px solid var(--feat-card-border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-input-row input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}
.ai-input-row button {
    background: linear-gradient(135deg, var(--secondary-color), #0d9488);
    color: white;
    border: none;
    width: 44px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.15s;
}
.ai-input-row button:hover { transform: scale(1.05); }
.ai-input-row button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

@media (max-width: 768px) {
    .ai-fab {
        left: 15px;
        bottom: 90px;
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
    .ai-panel {
        left: 10px;
        right: 10px;
        bottom: 80px;
        width: auto;
        max-width: none;
        height: 70vh;
    }
}

/* ==========================================================
   2. INTERACTIVE DATA EXPLORER
   ========================================================== */
.data-explorer {
    background: white;
    border-radius: var(--feat-radius);
    box-shadow: var(--feat-shadow);
    overflow: hidden;
    margin: 24px 0;
}
.de-toolbar {
    background: linear-gradient(135deg, var(--primary-color), #1a202c);
    color: white;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.de-toolbar h4 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.de-stats {
    display: flex;
    gap: 18px;
    font-size: 0.85rem;
}
.de-stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.de-stat-num {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-color);
}
.de-stat-num.survive { color: #4ade80; }
.de-stat-num.died    { color: #f87171; }

.de-filters {
    padding: 18px 22px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    background: var(--feat-bg-soft);
    border-bottom: 1px solid var(--feat-card-border);
}
.de-filter label {
    display: block;
    font-size: 0.78rem;
    color: var(--feat-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.de-filter select,
.de-filter input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--feat-card-border);
    border-radius: 8px;
    background: white;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.de-filter select:focus,
.de-filter input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}
.de-age-range {
    display: flex;
    gap: 6px;
    align-items: center;
}
.de-age-range input { padding: 6px 8px; font-size: 0.85rem; }
.de-reset-btn {
    background: white;
    border: 1px solid var(--feat-card-border);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    align-self: end;
    transition: all 0.2s;
}
.de-reset-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.de-table-wrap {
    max-height: 480px;
    overflow: auto;
}
.de-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.de-table thead {
    position: sticky;
    top: 0;
    background: white;
    z-index: 2;
    box-shadow: 0 1px 0 var(--feat-card-border);
}
.de-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background 0.15s;
}
.de-table th:hover { background: var(--feat-bg-soft); }
.de-table th .sort-ind {
    color: var(--secondary-color);
    font-size: 0.85rem;
    margin-left: 4px;
}
.de-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text-primary);
}
.de-table tbody tr:hover { background: #f8fafc; }
.de-row-survived td:nth-child(2)::before {
    content: "✓ ";
    color: #4ade80;
    font-weight: 700;
}
.de-row-died td:nth-child(2)::before {
    content: "✗ ";
    color: #f87171;
    font-weight: 700;
}
.de-empty {
    padding: 40px;
    text-align: center;
    color: var(--feat-muted);
}
.de-loading {
    padding: 40px;
    text-align: center;
    color: var(--feat-muted);
}
.de-loading .spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--feat-card-border);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================
   3. EXCEL FORMULA SANDBOX
   ========================================================== */
.formula-sandbox {
    background: white;
    border-radius: var(--feat-radius);
    box-shadow: var(--feat-shadow);
    overflow: hidden;
    margin: 24px 0;
}
.fs-header {
    background: linear-gradient(135deg, #1E293B, #0F172A);
    color: white;
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.fs-header h4 {
    margin: 0;
    font-size: 1.1rem;
}
.fs-header .fs-hint {
    font-size: 0.82rem;
    opacity: 0.8;
}
.fs-body {
    padding: 22px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}
.fs-input-side label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--feat-muted);
    margin-bottom: 6px;
    font-weight: 600;
}
.fs-input-side .fs-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--feat-card-border);
    border-radius: 10px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 1rem;
    outline: none;
    background: var(--feat-bg-soft);
    color: var(--primary-color);
    transition: border-color 0.2s, background 0.2s;
}
.fs-input-side .fs-input:focus {
    border-color: var(--secondary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}
.fs-examples {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.fs-example-chip {
    background: var(--feat-bg-soft);
    border: 1px solid var(--feat-card-border);
    color: var(--primary-color);
    padding: 5px 12px;
    border-radius: 999px;
    font-family: 'Monaco', monospace;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}
.fs-example-chip:hover {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
    transform: translateY(-1px);
}
.fs-supported {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(241, 143, 1, 0.08);
    border-left: 3px solid var(--accent-color);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--primary-color);
}
.fs-supported code {
    background: white;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    margin: 0 2px;
}

.fs-result-side {
    background: var(--feat-bg-soft);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.fs-result-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--feat-muted);
    font-weight: 600;
    margin-bottom: 8px;
}
.fs-result-value {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Monaco', monospace;
    word-break: break-all;
    line-height: 1.1;
}
.fs-result-value.fs-error {
    color: var(--danger-color);
    font-size: 1.3rem;
}
.fs-result-explain {
    margin-top: 12px;
    color: var(--feat-muted);
    font-size: 0.88rem;
    line-height: 1.5;
}
.fs-data-preview {
    margin-top: 14px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--feat-muted);
    border: 1px solid var(--feat-card-border);
}
.fs-data-preview strong { color: var(--primary-color); }

@media (max-width: 768px) {
    .fs-body { grid-template-columns: 1fr; }
}

/* ==========================================================
   4. KNOWLEDGE CHECK QUIZZES
   ========================================================== */
.quiz-card {
    background: white;
    border-radius: var(--feat-radius);
    box-shadow: var(--feat-shadow);
    margin-top: 20px;
    overflow: hidden;
    border-left: 4px solid var(--secondary-color);
}
.quiz-header {
    padding: 18px 22px 12px;
    border-bottom: 1px solid var(--feat-card-border);
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.06), transparent);
}
.quiz-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.quiz-header .quiz-progress {
    font-size: 0.85rem;
    color: var(--feat-muted);
    margin-top: 4px;
}
.quiz-body { padding: 22px; }
.quiz-question {
    margin-bottom: 24px;
}
.quiz-question:last-child { margin-bottom: 0; }
.quiz-q-text {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1rem;
    line-height: 1.5;
}
.quiz-q-text .quiz-q-num {
    background: var(--primary-color);
    color: white;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    margin-right: 8px;
    font-weight: 700;
}
.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.quiz-option {
    padding: 12px 16px;
    border: 2px solid var(--feat-card-border);
    border-radius: 10px;
    background: white;
    cursor: pointer;
    font-size: 0.95rem;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}
.quiz-option:hover:not(.disabled) {
    border-color: var(--secondary-color);
    background: rgba(20, 184, 166, 0.04);
    transform: translateX(2px);
}
.quiz-option.selected {
    border-color: var(--secondary-color);
    background: rgba(20, 184, 166, 0.08);
}
.quiz-option.correct {
    border-color: var(--success-color);
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
    font-weight: 600;
}
.quiz-option.wrong {
    border-color: var(--danger-color);
    background: rgba(199, 62, 29, 0.08);
    color: var(--danger-color);
    font-weight: 600;
}
.quiz-option.disabled { cursor: default; }
.quiz-option .quiz-letter {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: var(--feat-bg-soft);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.quiz-option.correct .quiz-letter { background: var(--success-color); color: white; }
.quiz-option.wrong   .quiz-letter { background: var(--danger-color); color: white; }

.quiz-feedback {
    margin-top: 10px;
    padding: 12px 14px;
    background: var(--feat-bg-soft);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--feat-muted);
    border-left: 3px solid var(--secondary-color);
    display: none;
}
.quiz-feedback.visible { display: block; animation: msgIn 0.3s ease-out; }
.quiz-feedback strong { color: var(--primary-color); }

.quiz-footer {
    padding: 18px 22px;
    border-top: 1px solid var(--feat-card-border);
    background: var(--feat-bg-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.quiz-score {
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}
.quiz-score .quiz-score-pct {
    color: var(--accent-color);
    font-size: 1.4rem;
    margin-left: 6px;
}
.quiz-submit {
    background: linear-gradient(135deg, var(--secondary-color), #0d9488);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}
.quiz-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(20, 184, 166, 0.4);
}
.quiz-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.quiz-retake {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--feat-card-border);
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}
.quiz-retake:hover { background: white; }

/* ==========================================================
   5. PER-MODULE NOTES
   ========================================================== */
.notes-card {
    background: white;
    border-radius: var(--feat-radius);
    box-shadow: var(--feat-shadow);
    margin-top: 20px;
    border-left: 4px solid var(--accent-color);
    overflow: hidden;
}
.notes-header {
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(241, 143, 1, 0.06), transparent);
    border-bottom: 1px solid var(--feat-card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.notes-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.05rem;
}
.notes-status {
    font-size: 0.78rem;
    color: var(--feat-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}
.notes-status .save-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
}
.notes-status .save-dot.saving { background: var(--accent-color); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse {
    50% { opacity: 0.4; }
}
.notes-textarea {
    width: 100%;
    min-height: 100px;
    padding: 14px 18px;
    border: none;
    outline: none;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: white;
}
.notes-textarea::placeholder { color: #cbd5e1; }

/* ==========================================================
   6. ACHIEVEMENTS + ANALYTICS
   ========================================================== */
.analytics-section {
    background: linear-gradient(135deg, #0F172A, #1E293B);
    color: white;
    padding: 60px 0;
    margin-top: 40px;
}
.analytics-section .container { max-width: 1200px; }
.analytics-section h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 10px;
    background-image: linear-gradient(90deg, #60A5FA 0%, #C084FC 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.analytics-section .feat-lead {
    text-align: center;
    color: #cbd5e1;
    max-width: 700px;
    margin: 0 auto 40px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 40px;
}
.metric-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 22px;
    text-align: center;
    backdrop-filter: blur(8px);
}
.metric-card .metric-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}
.metric-card .metric-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    line-height: 1;
    margin-bottom: 6px;
}
.metric-card .metric-value.accent { color: var(--accent-color); }
.metric-card .metric-value.success { color: #4ade80; }
.metric-card .metric-label {
    color: #94a3b8;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.module-time-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 40px;
}
.module-time-cell {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}
.module-time-cell .mt-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.module-time-cell .mt-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    font-family: 'Monaco', monospace;
}
.module-time-cell.completed {
    background: rgba(76, 175, 80, 0.12);
    border-color: rgba(76, 175, 80, 0.3);
}
.module-time-cell.completed .mt-value { color: #4ade80; }
@media (max-width: 768px) {
    .module-time-grid { grid-template-columns: repeat(3, 1fr); }
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}
.badge-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 20px 12px;
    text-align: center;
    transition: all 0.3s;
    opacity: 0.4;
    filter: grayscale(0.8);
}
.badge-card.earned {
    opacity: 1;
    filter: none;
    background: linear-gradient(135deg, rgba(241, 143, 1, 0.15), rgba(20, 184, 166, 0.1));
    border-color: rgba(241, 143, 1, 0.3);
    box-shadow: 0 4px 20px rgba(241, 143, 1, 0.15);
}
.badge-card.earned:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 26px rgba(241, 143, 1, 0.25);
}
.badge-card .badge-icon {
    font-size: 2.3rem;
    margin-bottom: 6px;
    display: block;
}
.badge-card .badge-name {
    font-weight: 700;
    color: white;
    font-size: 0.92rem;
    margin-bottom: 3px;
}
.badge-card .badge-desc {
    color: #94a3b8;
    font-size: 0.76rem;
    line-height: 1.3;
}

/* Confetti burst overlay for badge unlocks */
.confetti-burst {
    position: fixed;
    top: 50%; left: 50%;
    width: 0; height: 0;
    pointer-events: none;
    z-index: 10000;
}
.confetti-piece {
    position: absolute;
    width: 10px;
    height: 14px;
    top: 0; left: 0;
    animation: confettiFly 1.4s ease-out forwards;
}
@keyframes confettiFly {
    0%   { transform: translate(0,0) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--cx,0), var(--cy,0)) rotate(720deg); opacity: 0; }
}

/* Badge toast */
.badge-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, var(--accent-color), #d97706);
    color: white;
    padding: 14px 22px 14px 18px;
    border-radius: 14px;
    box-shadow: 0 10px 40px rgba(241, 143, 1, 0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90vw;
}
.badge-toast.show { transform: translateX(-50%) translateY(0); }
.badge-toast .bt-icon { font-size: 2rem; }
.badge-toast .bt-text strong { display: block; margin-bottom: 2px; font-size: 1rem; }
.badge-toast .bt-text span { font-size: 0.85rem; opacity: 0.9; }

/* ==========================================================
   Stats banner under main hero (resume + quick stats)
   ========================================================== */
.resume-banner {
    background: white;
    border-radius: var(--feat-radius);
    box-shadow: var(--feat-shadow);
    margin: 30px auto -20px;
    max-width: 1100px;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: relative;
    z-index: 5;
    flex-wrap: wrap;
}
.resume-banner .rb-text strong {
    color: var(--primary-color);
    font-size: 1rem;
}
.resume-banner .rb-text p {
    color: var(--feat-muted);
    font-size: 0.88rem;
    margin: 2px 0 0;
}
.resume-banner .rb-action {
    background: linear-gradient(135deg, var(--secondary-color), #0d9488);
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}
.resume-banner .rb-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(20, 184, 166, 0.35);
}
.resume-banner.hidden { display: none; }

/* ==========================================================
   Module 6 — Enhanced story output
   ========================================================== */
.story-output-enhanced {
    background: white;
    border-radius: var(--feat-radius);
    box-shadow: var(--feat-shadow-lg);
    padding: 32px;
    margin-top: 22px;
    border-top: 5px solid var(--accent-color);
}
.story-output-enhanced h4 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: 16px;
}
.story-output-enhanced .story-section {
    margin-bottom: 16px;
    padding-left: 14px;
    border-left: 3px solid var(--secondary-color);
}
.story-output-enhanced .story-section h5 {
    color: var(--secondary-color);
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    font-weight: 700;
}
.story-output-enhanced .story-section p {
    color: var(--text-primary);
    line-height: 1.7;
    margin: 0;
}
.story-output-enhanced .story-meta {
    font-size: 0.82rem;
    color: var(--feat-muted);
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--feat-card-border);
}
.story-copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 14px;
    font-size: 0.88rem;
    transition: background 0.2s;
}
.story-copy-btn:hover { background: var(--secondary-color); }
