/* ─── Variables ────────────────────────────────────────────── */
:root {
    --bg-primary: #0f0f12;
    --bg-secondary: #1a1a24;
    --bg-tertiary: #232334;
    --bg-card: #1e1e2e;
    --bg-hover: #2a2a3e;
    --text-primary: #e8e8f0;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b82;
    --accent-gold: #f5c542;
    --accent-gold-dim: #c49a2a;
    --accent-green: #4ade80;
    --accent-yellow: #facc15;
    --accent-red: #f87171;
    --accent-blue: #60a5fa;
    --accent-purple: #a78bfa;
    --accent-teal: #2dd4bf;
    --border: #2a2a3e;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    /* Character stage */
    --stage-bg: #12121c;
    --floor-color: #1a1a28;
    --podium-color: #2a2a3e;
}

/* ─── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}
.screen { display: none; }
.screen.active { display: flex; }

/* ─── Landing Page ────────────────────────────────────────── */
#landing { justify-content: center; align-items: center; min-height: 100vh; padding: 2rem; }
.landing-container { max-width: 900px; width: 100%; }
.logo-section { text-align: center; margin-bottom: 3rem; }
.logo-icon { font-size: 5rem; margin-bottom: 1rem; filter: drop-shadow(0 0 20px rgba(245, 197, 66, 0.3)); }
.logo-section h1 {
    font-size: 2.8rem; font-weight: 800;
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    line-height: 1.1; margin-bottom: 0.75rem;
}
.tagline { font-size: 1.15rem; color: var(--text-secondary); font-weight: 500; }
.setup-section h2 {
    font-size: 1.1rem; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem; margin-top: 2rem;
}

/* ─── Role Grid ───────────────────────────────────────────── */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.75rem; }
.role-card {
    background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius);
    padding: 1rem; cursor: pointer; transition: all 0.2s; text-align: center;
}
.role-card:hover { border-color: var(--accent-gold-dim); background: var(--bg-hover); transform: translateY(-2px); }
.role-card.selected { border-color: var(--accent-gold); background: rgba(245, 197, 66, 0.08); box-shadow: 0 0 20px rgba(245, 197, 66, 0.15); }
.role-card .role-emoji { font-size: 2rem; margin-bottom: 0.5rem; }
.role-card .role-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.role-card .role-desc { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ─── Skill Grid ──────────────────────────────────────────── */
.skill-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.skill-card {
    background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius);
    padding: 1.25rem; cursor: pointer; transition: all 0.2s; text-align: center;
}
.skill-card:hover { border-color: var(--accent-purple); transform: translateY(-2px); }
.skill-card.selected { border-color: var(--accent-purple); background: rgba(167, 139, 250, 0.08); box-shadow: 0 0 20px rgba(167, 139, 250, 0.15); }
.skill-card .skill-level { font-size: 1rem; font-weight: 700; margin-bottom: 0.25rem; }
.skill-card .skill-desc { font-size: 0.78rem; color: var(--text-secondary); }
.skill-card .skill-badge { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 20px; font-size: 0.7rem; font-weight: 600; margin-top: 0.5rem; }
.skill-card:nth-child(1) .skill-badge { background: rgba(74, 222, 128, 0.15); color: var(--accent-green); }
.skill-card:nth-child(2) .skill-badge { background: rgba(96, 165, 250, 0.15); color: var(--accent-blue); }
.skill-card:nth-child(3) .skill-badge { background: rgba(245, 197, 66, 0.15); color: var(--accent-gold); }

/* ─── Buttons ─────────────────────────────────────────────── */
.btn-primary {
    display: inline-block; background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    color: #000; font-family: var(--font); font-size: 1rem; font-weight: 700;
    padding: 0.9rem 2.5rem; border: none; border-radius: var(--radius);
    cursor: pointer; transition: all 0.2s; margin-top: 2rem; width: 100%;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(245, 197, 66, 0.3); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-large { font-size: 1.1rem; padding: 1rem 3rem; width: auto; }
.btn-ff {
    background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border);
    font-family: var(--font); font-size: 0.85rem; font-weight: 600;
    padding: 0.6rem 1rem; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
    width: 100%; margin-bottom: 0.5rem;
}
.btn-ff:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-end {
    background: transparent; color: var(--text-muted); border: 1px solid var(--border);
    font-family: var(--font); font-size: 0.8rem; font-weight: 500;
    padding: 0.5rem 1rem; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s; width: 100%;
}
.btn-end:hover { color: var(--accent-red); border-color: var(--accent-red); }
.btn-cc {
    background: var(--bg-tertiary); color: var(--text-muted); border: 1px solid var(--border);
    font-family: var(--font); font-size: 0.8rem; font-weight: 700;
    padding: 0.5rem 1rem; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
    letter-spacing: 0.05em;
}
.btn-cc.active { background: var(--accent-blue); color: #000; border-color: var(--accent-blue); }
.btn-cc:hover { border-color: var(--text-secondary); }

/* ─── Meeting Layout ──────────────────────────────────────── */
#meeting { min-height: 100vh; }
.meeting-layout { display: flex; min-height: 100vh; width: 100%; }

/* ─── Agenda Sidebar ──────────────────────────────────────── */
.agenda-sidebar {
    width: 260px; min-width: 260px; background: var(--bg-secondary);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    height: 100vh; position: sticky; top: 0;
}
.agenda-header {
    padding: 1.25rem 1rem; border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}
.agenda-header h3 { font-size: 0.95rem; font-weight: 700; }
.phase-badge { font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 20px; background: rgba(245, 197, 66, 0.15); color: var(--accent-gold); }
.agenda-list { flex: 1; overflow-y: auto; padding: 0.5rem 0; }
.agenda-item {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.8rem;
    border-left: 3px solid transparent; transition: all 0.15s; opacity: 0.5; cursor: pointer;
}
.agenda-item:hover { background: rgba(255,255,255,0.02); }
.agenda-item.active { background: rgba(245, 197, 66, 0.06); border-left-color: var(--accent-gold); opacity: 1; }
.agenda-item.done { opacity: 0.7; }
.agenda-item.user-turn { background: rgba(96, 165, 250, 0.06); border-left-color: var(--accent-blue); }
.agenda-item.user-turn.active { background: rgba(96, 165, 250, 0.12); border-left-color: var(--accent-blue); opacity: 1; }
.agenda-emoji { font-size: 1rem; width: 24px; text-align: center; }
.agenda-info { flex: 1; min-width: 0; }
.agenda-role { font-size: 0.75rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-meta { font-size: 0.65rem; color: var(--text-muted); }
.agenda-status { font-size: 0.7rem; }
.sidebar-actions { padding: 0.75rem; border-top: 1px solid var(--border); }

/* ─── Stage ───────────────────────────────────────────────── */
.stage { flex: 1; display: flex; flex-direction: column; min-height: 100vh; position: relative; }

/* ─── Character Stage (visual) ────────────────────────────── */
.character-stage {
    height: 320px;
    background: var(--stage-bg);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.stage-floor {
    position: absolute; bottom: 0; left: 0; right: 0; height: 40px;
    background: linear-gradient(to bottom, var(--floor-color), #0e0e16);
    border-top: 1px solid rgba(255,255,255,0.03);
}
.podium {
    position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
    font-size: 2rem; background: var(--podium-color);
    padding: 0.8rem 2rem; border-radius: 8px 8px 0 0;
    border: 1px solid var(--border); border-bottom: none;
    z-index: 2;
}

/* ─── Character Container ─────────────────────────────────── */
.character-container {
    position: absolute; bottom: 55px; left: 50%; transform: translateX(-50%);
    z-index: 3;
    transition: opacity 0.5s ease;
}

/* ─── Character Body ──────────────────────────────────────── */
.character {
    display: flex; flex-direction: column; align-items: center;
    position: relative;
    animation: charEnter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.character.exiting {
    animation: charExit 0.5s ease-in forwards;
}

@keyframes charEnter {
    from { opacity: 0; transform: translateY(40px) scale(0.8); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes charExit {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(30px) scale(0.9); }
}

/* Head */
.char-head {
    width: 64px; height: 64px; border-radius: 50%;
    position: relative; z-index: 2;
    transition: background 0.3s;
}
/* Hair (pseudo-element on top of head) */
.char-hair {
    position: absolute; top: -6px; left: 8px; right: 8px; height: 30px;
    border-radius: 30px 30px 0 0; z-index: 1;
}
/* Face features */
.char-eyes {
    position: absolute; top: 22px; left: 14px; right: 14px;
    display: flex; justify-content: space-between; z-index: 3;
}
.char-eye {
    width: 8px; height: 8px; background: #1a1a2e; border-radius: 50%;
    transition: all 0.3s;
}
/* Eye states */
.character.nervous .char-eye { height: 6px; border-radius: 4px; }
.character.confident .char-eye { height: 10px; width: 9px; }
.character.happy .char-eye { height: 5px; border-radius: 5px 5px 0 0; }

/* Eyebrows */
.char-eyebrows {
    position: absolute; top: 14px; left: 12px; right: 12px;
    display: flex; justify-content: space-between; z-index: 3;
}
.char-eyebrow {
    width: 12px; height: 3px; background: rgba(0,0,0,0.3); border-radius: 2px;
    transition: all 0.3s;
}
.character.nervous .char-eyebrow { transform: rotate(-5deg); }
.character.confident .char-eyebrow { transform: translateY(-2px); }

/* Mouth */
.char-mouth {
    position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
    width: 16px; height: 6px; border-radius: 0 0 10px 10px;
    background: rgba(0,0,0,0.2); z-index: 3;
    transition: all 0.3s;
}
.character.happy .char-mouth { height: 10px; width: 18px; background: rgba(180,40,40,0.3); border-radius: 0 0 12px 12px; }
.character.nervous .char-mouth { width: 10px; height: 4px; border-radius: 4px; }
.character.speaking .char-mouth { animation: mouthMove 0.3s infinite alternate; }

@keyframes mouthMove {
    from { height: 4px; width: 14px; }
    to { height: 10px; width: 18px; }
}

/* Neck */
.char-neck {
    width: 14px; height: 10px; margin-top: -2px; z-index: 1;
}

/* Body / Torso */
.char-body {
    width: 56px; height: 60px; border-radius: 8px 8px 4px 4px;
    margin-top: 2px; position: relative; z-index: 1;
    transition: transform 0.3s;
}
/* Arms */
.char-arms {
    position: absolute; top: 5px; left: -14px; right: -14px;
    display: flex; justify-content: space-between;
}
.char-arm {
    width: 14px; height: 40px; border-radius: 7px;
    transition: all 0.4s ease;
    transform-origin: top center;
}
/* Arm positions */
.character.speaking .char-arm.left { animation: armGestureL 2s ease-in-out infinite; }
.character.speaking .char-arm.right { animation: armGestureR 2s ease-in-out infinite 0.3s; }
.character.nervous .char-arm.left { transform: rotate(10deg); }
.character.nervous .char-arm.right { transform: rotate(-10deg); }
.character.confident .char-arm.left { transform: rotate(-5deg); }
.character.confident .char-arm.right { transform: rotate(5deg); }

@keyframes armGestureL {
    0%, 100% { transform: rotate(5deg); }
    50% { transform: rotate(-15deg); }
}
@keyframes armGestureR {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(15deg); }
}

/* Legs */
.char-legs {
    display: flex; gap: 6px; margin-top: 2px;
}
.char-leg {
    width: 18px; height: 36px; border-radius: 4px 4px 6px 6px;
}
/* Shoes */
.char-shoe {
    width: 22px; height: 8px; border-radius: 4px 8px 4px 4px; margin-top: -1px;
}

/* ─── Name Tag ────────────────────────────────────────────── */
.char-name-tag {
    position: absolute; bottom: -28px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.7); color: var(--text-primary);
    font-size: 0.7rem; font-weight: 600; padding: 0.2rem 0.6rem;
    border-radius: 4px; white-space: nowrap; z-index: 10;
    backdrop-filter: blur(4px);
}
.char-role-tag {
    position: absolute; bottom: -44px; left: 50%; transform: translateX(-50%);
    font-size: 0.6rem; color: var(--text-muted); white-space: nowrap; z-index: 10;
}

/* ─── Body Language Animations ────────────────────────────── */
.character.idle { animation: charEnter 0.6s ease forwards, idleBounce 3s ease-in-out infinite 0.6s; }
.character.speaking { animation: charEnter 0.6s ease forwards, speakSway 4s ease-in-out infinite 0.6s; }
.character.nervous { animation: charEnter 0.6s ease forwards, nervousSway 1.5s ease-in-out infinite 0.6s; }
.character.confident { animation: charEnter 0.6s ease forwards; }

@keyframes idleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}
@keyframes speakSway {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-2px) rotate(0.5deg); }
    75% { transform: translateY(-1px) rotate(-0.5deg); }
}
@keyframes nervousSway {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* ─── CC Bar (Subtitles) ──────────────────────────────────── */
.cc-bar {
    background: rgba(0, 0, 0, 0.85); border-top: 1px solid var(--border);
    padding: 0.8rem 2rem; min-height: 48px; display: flex; align-items: center;
    justify-content: center; backdrop-filter: blur(8px);
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.cc-bar.visible { opacity: 1; }
.cc-text {
    font-size: 1rem; font-weight: 500; color: #fff;
    text-align: center; max-width: 700px; line-height: 1.4;
}

/* ─── Meeting Log ─────────────────────────────────────────── */
.stage-content { flex: 1; overflow-y: auto; }
.meeting-log { padding: 1.5rem 2rem; display: flex; flex-direction: column; gap: 1rem; }
.agent-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem; animation: fadeSlideUp 0.4s ease-out;
}
.agent-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.agent-avatar {
    font-size: 1.5rem; width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-tertiary); border-radius: 50%;
}
.agent-info h3 { font-size: 1rem; font-weight: 700; }
.agent-meta { font-size: 0.78rem; color: var(--text-muted); }
.skill-tag { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px; font-size: 0.68rem; font-weight: 600; margin-left: 0.5rem; }
.skill-tag.beginner { background: rgba(74, 222, 128, 0.15); color: var(--accent-green); }
.skill-tag.intermediate { background: rgba(96, 165, 250, 0.15); color: var(--accent-blue); }
.skill-tag.advanced { background: rgba(245, 197, 66, 0.15); color: var(--accent-gold); }
.agent-content { font-size: 0.9rem; line-height: 1.7; color: var(--text-primary); white-space: pre-wrap; }

/* ─── User Input ──────────────────────────────────────────── */
.user-input-area { margin-top: 0.75rem; }
.user-prompt {
    background: rgba(96, 165, 250, 0.08); border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: var(--radius); padding: 0.8rem 1rem; margin-bottom: 0.75rem;
    font-size: 0.85rem; color: var(--accent-blue); font-weight: 500;
}
.textarea-wrapper { position: relative; }
.user-textarea {
    width: 100%; min-height: 160px; background: var(--bg-tertiary);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 0.8rem 1rem; padding-bottom: 2.2rem;
    font-family: var(--font); font-size: 0.9rem; color: var(--text-primary);
    resize: vertical; line-height: 1.6; transition: border-color 0.2s;
}
.user-textarea:focus { outline: none; border-color: var(--accent-blue); }
.user-textarea::placeholder { color: var(--text-muted); }
.word-count {
    position: absolute; bottom: 0.5rem; right: 0.8rem;
    font-size: 0.72rem; font-weight: 600; color: var(--text-muted); pointer-events: none;
}
.submit-row { display: flex; justify-content: flex-end; margin-top: 0.6rem; gap: 0.5rem; align-items: center; }
.btn-submit {
    background: var(--accent-blue); color: #000; font-family: var(--font);
    font-size: 0.85rem; font-weight: 700; padding: 0.6rem 1.5rem;
    border: none; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
}
.btn-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(96, 165, 250, 0.3); }
.btn-speak {
    background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border);
    font-family: var(--font); font-size: 0.8rem; font-weight: 600;
    padding: 0.6rem 1rem; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
}
.btn-speak:hover { border-color: var(--accent-purple); color: var(--accent-purple); }
.btn-speak.speaking { background: var(--accent-purple); color: #000; border-color: var(--accent-purple); }

/* ─── Stage Controls ──────────────────────────────────────── */
.stage-controls {
    padding: 0.75rem 2rem 1rem; border-top: 1px solid var(--border);
    display: flex; justify-content: center; align-items: center; gap: 1rem;
    background: var(--bg-primary);
}

/* ─── Fast Forward Overlay ────────────────────────────────── */
.ff-overlay {
    position: fixed; inset: 0; background: rgba(15, 15, 18, 0.92);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; backdrop-filter: blur(8px);
}
.ff-overlay.hidden { display: none; }
.ff-content { text-align: center; max-width: 500px; }
.ff-content h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }
.ff-spinner {
    width: 48px; height: 48px; border: 3px solid var(--border);
    border-top-color: var(--accent-gold); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 1.5rem;
}
.ff-log { text-align: left; max-height: 300px; overflow-y: auto; }
.ff-log-item {
    display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 0;
    border-bottom: 1px solid var(--border); font-size: 0.85rem;
    animation: fadeSlideUp 0.3s ease-out;
}
.ff-log-item .ff-emoji { font-size: 1.2rem; }
.ff-log-item .ff-role { font-weight: 600; color: var(--text-primary); }
.ff-log-item .ff-preview { color: var(--text-muted); font-size: 0.78rem; }

/* ─── Feedback ────────────────────────────────────────────── */
#feedback { justify-content: center; align-items: center; min-height: 100vh; padding: 2rem; }
.feedback-container { max-width: 700px; width: 100%; }
.feedback-header { text-align: center; margin-bottom: 2rem; }
.trophy-icon { font-size: 4rem; margin-bottom: 0.75rem; }
.feedback-header h1 {
    font-size: 2rem; font-weight: 800;
    background: linear-gradient(135deg, var(--accent-gold), #ff9500);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.feedback-header p { color: var(--text-secondary); font-size: 1rem; }
.feedback-content {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 2rem;
    font-size: 0.95rem; line-height: 1.7; white-space: pre-wrap;
}
.feedback-loading { text-align: center; padding: 3rem; }
.feedback-actions { text-align: center; margin-top: 2rem; }
.feedback-actions .btn-primary { width: auto; display: inline-block; }

.highlight-flash { animation: highlightPulse 1.5s ease-out; }
.user-turn-card { border-color: rgba(96, 165, 250, 0.3) !important; background: rgba(96, 165, 250, 0.03); }

/* ─── Animations ──────────────────────────────────────────── */
@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes highlightPulse {
    0% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(96, 165, 250, 0); }
    100% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0); }
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .meeting-layout { flex-direction: column; }
    .agenda-sidebar { width: 100%; min-width: 100%; height: auto; max-height: 180px; position: relative; border-right: none; border-bottom: 1px solid var(--border); }
    .character-stage { height: 240px; }
    .meeting-log { padding: 1rem; }
    .skill-grid { grid-template-columns: 1fr; }
    .role-grid { grid-template-columns: repeat(2, 1fr); }
    .logo-section h1 { font-size: 2rem; }
}
