/* CSS Variables - Project Design System */
:root {
    --bg-dark: #0a0e27;
    --bg-darker: #050814;
    --bg-card: #131829;
    --primary: #a78bfa;
    --primary-bright: #c4b5fd;
    --accent: #06b6d4;
    --accent-bright: #22d3ee;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-dimmer: #64748b;
    --border: #1e293b;
    --border-bright: #334155;
    --success: #10b981;
    --danger: #ef4444;
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
}

/* Header */
.header {
    background-color: var(--bg-darker);
    border-bottom: 1px solid var(--border-bright);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.home-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s ease;
}

.home-link:hover {
    color: var(--primary-bright);
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Selector Card */
.selector-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mother-language-day {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.mother-language-day strong {
    color: var(--accent-bright);
}

.selector-label {
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-darker);
    border: 1px solid var(--border-bright);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--primary);
}

.select-wrapper select option {
    background-color: var(--bg-darker);
    color: var(--text);
}

.btn-random {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: var(--bg-dark);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-random:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.4);
}

/* Trivia Wrapper (card + tree side by side) */
.trivia-wrapper {
    display: flex;
    align-items: stretch;
    gap: 0;
    animation: fadeIn 0.3s ease;
}

/* Trivia Card */
.trivia-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 1.5rem;
    flex: 1;
    min-width: 0;
}

/* Language Family Tree */
.family-tree-container {
    width: 260px;
    flex-shrink: 0;
    opacity: 0.55;
    filter: grayscale(30%) brightness(0.85);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
}

.family-tree-container:hover {
    opacity: 1;
    filter: grayscale(0%) brightness(1);
    transform: scale(1.15);
}

#familyTree {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.tree-trunk {
    fill: none;
    stroke: #5d4037;
    stroke-width: 6;
    stroke-linecap: round;
}

.tree-branch {
    fill: none;
    stroke: #6d4c41;
    stroke-width: 3.5;
    stroke-linecap: round;
}

.tree-leaf {
    fill: #2e7d32;
    opacity: 0.85;
}

.tree-leaf-accent {
    fill: #388e3c;
    opacity: 0.7;
}

.tree-leaf-highlight {
    fill: #66bb6a;
    opacity: 1;
    filter: drop-shadow(0 0 6px rgba(102, 187, 106, 0.7));
}

.tree-label {
    font-family: 'Inter', sans-serif;
    font-size: 8.5px;
    font-weight: 600;
    fill: var(--text);
    text-anchor: middle;
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.tree-label-lang {
    font-size: 10px;
    font-weight: 700;
    fill: var(--accent-bright);
}

.family-tree-container:hover .tree-label {
    opacity: 1;
}

.tree-label-bg {
    fill: var(--bg-darker);
    rx: 4;
    ry: 4;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.family-tree-container:hover .tree-label-bg {
    opacity: 0.85;
}

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

.trivia-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.trivia-header h2 {
    margin: 0;
    font-size: 1.75rem;
    color: var(--text);
}

.native-name {
    display: block;
    margin-top: 0.5rem;
    font-size: 1.25rem;
    color: var(--primary);
}

/* Trivia Grid */
.trivia-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.trivia-item {
    background-color: var(--bg-darker);
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.trivia-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.trivia-content {
    flex: 1;
}

.trivia-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.trivia-value {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.4;
}

/* Fun Facts */
.fun-facts {
    background-color: var(--bg-darker);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.fun-facts h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    color: var(--text);
}

.fun-facts ul {
    margin: 0;
    padding-left: 1.25rem;
}

.fun-facts li {
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.fun-facts li:last-child {
    margin-bottom: 0;
}

/* Sample Phrase */
.sample-phrase {
    background-color: var(--bg-darker);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    text-align: center;
}

.sample-phrase h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--text);
}

.phrase {
    font-size: 1.5rem;
    color: var(--accent-bright);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header {
        padding: 0.75rem 1rem;
    }

    .header-content h1 {
        font-size: 1.25rem;
    }

    .trivia-grid {
        grid-template-columns: 1fr;
    }

    .trivia-header h2 {
        font-size: 1.5rem;
    }

    .native-name {
        font-size: 1.1rem;
    }

    .family-tree-container {
        display: none;
    }

    .container {
        max-width: 700px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border-bright);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}
