* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Roboto', sans-serif;
    background: #0a0a0f;
    min-height: 100vh;
    padding: 40px 20px;
    overflow-x: auto;
    color: #e0e0e0;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: linear-gradient(145deg, #1a1a24 0%, #151520 100%);
    border-radius: 16px;
    padding: 60px 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

h1 {
    text-align: center;
    color: #ffffff;
    margin-bottom: 8px;
    font-size: 2.8rem;
    font-weight: 300;
    letter-spacing: -0.5px;
}

.instructions {
    text-align: center;
    color: #888;
    margin-bottom: 50px;
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.emotions-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

/* Tree node structure */
.tree-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* The emotion button */
.emotion-btn {
    padding: 14px 28px;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: capitalize;
    position: relative;
    z-index: 2;
    background: rgba(30, 30, 40, 0.6);
    color: #e0e0e0;
    margin: 6px;
    backdrop-filter: blur(10px);
    letter-spacing: 0.3px;
}

.emotion-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(40, 40, 50, 0.8);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.emotion-btn.root {
    background: linear-gradient(135deg, #2d3561 0%, #1f2544 100%);
    color: #ffffff;
    font-size: 1.2rem;
    padding: 18px 36px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-weight: 400;
    letter-spacing: 0.5px;
}

.emotion-btn.root:hover {
    background: linear-gradient(135deg, #363d6e 0%, #252b52 100%);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.emotion-btn.level-1 {
    background: rgba(45, 53, 97, 0.7);
    color: #d4d9f5;
    font-size: 1.05rem;
    border-color: rgba(100, 120, 180, 0.3);
}

.emotion-btn.level-1:hover {
    background: rgba(55, 63, 107, 0.85);
    border-color: rgba(120, 140, 200, 0.4);
}

.emotion-btn.level-2 {
    background: rgba(40, 50, 70, 0.6);
    color: #c8cfe0;
    border-color: rgba(80, 100, 140, 0.3);
}

.emotion-btn.level-2:hover {
    background: rgba(50, 60, 80, 0.75);
    border-color: rgba(100, 120, 160, 0.4);
}

.emotion-btn.level-3 {
    background: rgba(35, 40, 55, 0.5);
    color: #b0b8c8;
    font-size: 0.88rem;
    border-color: rgba(60, 80, 110, 0.25);
}

.emotion-btn.level-3:hover {
    background: rgba(45, 50, 65, 0.65);
    border-color: rgba(80, 100, 130, 0.35);
}

.emotion-btn.expanded {
    border-color: rgba(150, 160, 200, 0.5);
    background: rgba(50, 60, 85, 0.8);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Children container */
.children-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px;
    position: relative;
    flex-wrap: wrap;
}

/* Connecting lines */
.tree-node.has-children > .emotion-btn::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    width: 1px;
    height: 30px;
    background: linear-gradient(180deg, rgba(100, 110, 140, 0.4) 0%, rgba(100, 110, 140, 0.2) 100%);
    transform: translateX(-50%);
}

.children-container::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(100, 110, 140, 0.3) 20%,
        rgba(100, 110, 140, 0.3) 80%,
        transparent 100%);
    z-index: 1;
}

.children-container > .tree-node::before {
    content: '';
    position: absolute;
    top: -30px;
    left: 50%;
    width: 1px;
    height: 30px;
    background: linear-gradient(180deg, rgba(100, 110, 140, 0.3) 0%, rgba(100, 110, 140, 0.2) 100%);
    transform: translateX(-50%);
    z-index: 1;
}

/* Hide children by default */
.children-container {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s ease;
}

.children-container.visible {
    max-height: 2000px;
    opacity: 1;
}

/* Tooltip styles */
.tooltip {
    position: fixed;
    padding: 10px 16px;
    background: rgba(20, 25, 35, 0.98);
    color: #e0e0e0;
    font-size: 0.85rem;
    font-weight: 400;
    border-radius: 6px;
    max-width: 280px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    line-height: 1.4;
    letter-spacing: 0.2px;
    white-space: normal;
}

.tooltip.visible {
    opacity: 1;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(20, 25, 35, 0.98);
}
