/* tutorial.css — Tutorial onboarding + Story quest hub */

/* ══════════════════════════════════════════════════════════
   TUTORIAL SCREEN
   ══════════════════════════════════════════════════════════ */

.tutorial-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 50% 40% at 50% 20%, rgba(245,158,11,0.08), transparent),
        var(--primary-color);
    padding: var(--spacing-lg) !important;
}

.tutorial-container {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* ── Narrator ── */
.tutorial-narrator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
}

.tutorial-portrait-wrap {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), var(--elevated-color));
    border: 2px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px rgba(245,158,11,0.15);
    animation: tutorialPortraitPulse 3s ease-in-out infinite;
}

@keyframes tutorialPortraitPulse {
    0%, 100% { box-shadow: 0 0 24px rgba(245,158,11,0.15); }
    50% { box-shadow: 0 0 36px rgba(245,158,11,0.3); }
}

.tutorial-portrait {
    font-size: 48px;
    line-height: 1;
}

.tutorial-narrator-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-color);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ── Dialogue text ── */
.tutorial-dialogue {
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    min-height: 100px;
    position: relative;
}

.tutorial-dialogue::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 14px;
    height: 14px;
    background: var(--secondary-color);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
}

.tutorial-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

/* ── Options ── */
.tutorial-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.tutorial-option-btn {
    width: 100%;
    padding: 14px var(--spacing-lg);
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    min-height: 44px;
}

.tutorial-option-btn:active {
    background: var(--elevated-color);
    border-color: var(--accent-color);
    transform: scale(0.98);
}

.tutorial-option-final {
    background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(217,119,6,0.1));
    border-color: var(--accent-color);
    color: var(--accent-color);
    text-align: center;
    font-size: 16px;
    letter-spacing: 0.5px;
}

.tutorial-option-final:active {
    background: linear-gradient(135deg, rgba(245,158,11,0.3), rgba(217,119,6,0.2));
}

/* ── Faction cards ── */
.tutorial-factions {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.tutorial-faction-card {
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    text-align: center;
}

.tutorial-faction-card:active {
    transform: scale(0.97);
}

.tutorial-faction-card.selected {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, rgba(245,158,11,0.1), rgba(217,119,6,0.05));
    box-shadow: 0 0 16px rgba(245,158,11,0.2);
}

.tutorial-faction-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: var(--spacing-xs);
}

.tutorial-faction-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tutorial-faction-motto {
    font-size: 12px;
    font-style: italic;
    color: var(--text-secondary);
}

.tutorial-faction-desc {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.tutorial-faction-bonuses {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-xs) var(--spacing-sm);
    margin-top: var(--spacing-xs);
}

.tutorial-faction-bonus {
    font-size: 12px;
    font-weight: 600;
    color: var(--success-color);
    background: rgba(16,185,129,0.1);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}


/* ══════════════════════════════════════════════════════════
   STORY SCREEN — Quest hub
   ══════════════════════════════════════════════════════════ */

.story-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.story-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.story-faction-badge {
    font-size: 12px;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(217,119,6,0.1));
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    color: var(--accent-color);
}

/* ── NPC list ── */
.story-npc-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    padding: 0 var(--spacing-md);
}

.story-npc-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.story-npc-card:active {
    background: var(--elevated-color);
    transform: scale(0.98);
}

.story-npc-locked {
    opacity: 0.5;
    cursor: default;
}

.story-npc-locked:active {
    background: var(--secondary-color);
    transform: none;
}

/* ── NPC portrait ── */
.story-npc-portrait-wrap {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 50%;
    background: var(--elevated-color);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-npc-card:not(.story-npc-locked) .story-npc-portrait-wrap {
    border-color: var(--accent-dim);
}

.story-npc-portrait {
    font-size: 28px;
    line-height: 1;
}

/* ── NPC info ── */
.story-npc-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.story-npc-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.story-npc-role {
    font-size: 12px;
    color: var(--accent-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.story-npc-bio {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 2px;
}

/* ── Reputation bar ── */
.story-npc-rep {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xs);
    flex-wrap: wrap;
}

.story-rep-bar {
    width: 80px;
    height: 6px;
    background: var(--elevated-color);
    border-radius: 3px;
    overflow: hidden;
}

.story-rep-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-dim), var(--accent-color));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.story-rep-text {
    font-size: 11px;
    color: var(--text-muted);
}

.story-rep-discount {
    font-size: 11px;
    font-weight: 600;
    color: var(--success-color);
}

/* ── Arrow ── */
.story-npc-arrow {
    font-size: 20px;
    color: var(--text-muted);
    font-weight: 300;
}

.story-npc-card:not(.story-npc-locked) .story-npc-arrow {
    color: var(--accent-dim);
}

/* ── Quest Header (back button + NPC info) ── */
.story-quest-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 0 var(--spacing-md) var(--spacing-sm);
}

.story-back-btn {
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    padding: 8px 14px;
    cursor: pointer;
    min-height: 44px;
}

.story-back-btn:active {
    background: var(--elevated-color);
}

.story-quest-npc-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.story-quest-npc-portrait {
    font-size: 28px;
}

.story-quest-npc-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Quest sections ── */
.story-quest-section {
    padding: 0 var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.story-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

/* ── Quest card ── */
.story-quest-card {
    background: var(--secondary-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.story-quest-available {
    border-left: 3px solid var(--accent-color);
}

.story-quest-active {
    border-left: 3px solid var(--warning-color);
}

.story-quest-done {
    border-left: 3px solid var(--success-color);
    opacity: 0.7;
}

.story-quest-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.story-quest-type {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.story-quest-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.story-badge-new {
    color: var(--accent-color);
    background: rgba(var(--accent-rgb, 255,165,0), 0.15);
}

.story-badge-active {
    color: var(--warning-color);
    background: rgba(255, 193, 7, 0.15);
}

.story-badge-ready {
    color: var(--success-color);
    background: rgba(76, 175, 80, 0.15);
    animation: story-pulse 1.5s infinite;
}

.story-badge-done {
    color: var(--text-muted);
}

@keyframes story-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.story-quest-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.story-quest-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 8px;
}

/* ── Quest progress bar ── */
.story-quest-progress {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: 8px;
}

.story-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--elevated-color);
    border-radius: 4px;
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--warning-color), var(--success-color));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.story-progress-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 40px;
    text-align: right;
}

/* ── Quest rewards ── */
.story-quest-rewards {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    margin-bottom: 8px;
}

.story-reward {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--elevated-color);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

/* ── Quest action buttons ── */
.story-quest-btn {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.story-btn-accept {
    background: var(--accent-color);
    color: #000;
}

.story-btn-accept:active {
    opacity: 0.8;
}

.story-btn-turnin {
    background: var(--success-color);
    color: #fff;
    animation: story-pulse 1.5s infinite;
}

.story-btn-turnin:active {
    opacity: 0.8;
}

.story-btn-story {
    background: var(--secondary-color);
    border: 1px solid var(--accent-dim);
    color: var(--accent-color);
}

.story-btn-story:active {
    background: var(--elevated-color);
}

/* ═══════════════════════════════════════
   CLASS CARDS (tutorial step)
   ═════════════════════════════════════ */

.tutorial-class-skills {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    width: 100%;
    margin-top: var(--spacing-sm);
}

.tutorial-class-skill {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-sm);
    padding: var(--spacing-sm);
    text-align: left;
}

.tutorial-class-skill-icon {
    font-size: 20px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.tutorial-class-skill-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tutorial-class-skill-info strong {
    font-size: 13px;
    color: var(--text-primary);
}

.tutorial-class-skill-info small {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

/* ═══════════════════════════════════════
   DIALOGUE OVERLAY
   ═════════════════════════════════════ */

.dialogue-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0 env(safe-area-inset-bottom, 0) 0;
}

.dialogue-container {
    width: 100%;
    max-width: 480px;
    background: var(--card-color, #1a1a2e);
    border-top: 2px solid var(--accent-color, #f5a623);
    border-radius: 16px 16px 0 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 70vh;
    overflow-y: auto;
}

/* ── Dialogue header: portrait + name ── */
.dialogue-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dialogue-npc-portrait {
    font-size: 48px;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    border: 2px solid var(--accent-color, #f5a623);
    flex-shrink: 0;
}

.dialogue-npc-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-color, #f5a623);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Text box with typewriter ── */
.dialogue-text-box {
    min-height: 80px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md, 8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.dialogue-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary, #e0e0e0);
    min-height: 48px;
}

/* Blinking cursor effect during typewriter */
.dialogue-text::after {
    content: '▌';
    animation: dialogue-blink 0.6s infinite;
    color: var(--accent-color, #f5a623);
    margin-left: 2px;
}

@keyframes dialogue-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ── Player choices ── */
.dialogue-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dialogue-choice-btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md, 8px);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1.4;
}

.dialogue-choice-btn:active {
    background: rgba(245, 166, 35, 0.2);
    border-color: var(--accent-color, #f5a623);
}

.dialogue-choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
