@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@300;400;600;800&display=swap');

:root {
    --primary-color: #1a1a1a;
    --accent-color: #d4af37;
    /* Gold accent for premium feel */
    --text-color: #333;
    --bg-color: #f5f5f7;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: var(--primary-color);
    color: white;
    padding: 40px 0;
    text-align: center;
    border-bottom: 5px solid var(--accent-color);
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 10px 0;
}

.report-meta {
    font-size: 0.9rem;
    opacity: 0.8;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.report-meta span {
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 2px 10px;
    border-radius: 15px;
}

/* Top Visual */
.visual-section {
    text-align: center;
    margin-bottom: 40px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.chart-container {
    position: relative;
    height: 400px;
    background: white;
    padding: 10px;
    border-radius: 8px;
}

/* Navigation Grid */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 50px;
}

.nav-btn {
    display: block;
    background: white;
    padding: 15px 10px;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    font-weight: 600;
}

.nav-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
    color: var(--primary-color);
    background: #fffdf5;
}

.nav-btn span.date {
    display: block;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.nav-btn span.label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}

/* Main Content */
.report-content {
    background: var(--card-bg);
    padding: 50px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
    margin-top: 50px;
}

h3 {
    font-size: 1.4rem;
    color: #444;
    margin-top: 30px;
    border-left: 4px solid var(--accent-color);
    padding-left: 15px;
}

h4 {
    font-size: 1.2rem;
    color: #555;
    margin-top: 25px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95rem;
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

tr:hover {
    background-color: #f1f1f1;
}

pre {
    background: #2b2b2b;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 20px 0;
}

blockquote {
    background: #f9f9ff;
    border-left: 5px solid #0056b3;
    margin: 20px 0;
    padding: 15px 20px;
    font-style: italic;
    color: #555;
}

/* Footer */
footer {
    text-align: center;
    padding: 50px 0;
    color: #888;
    font-size: 0.9rem;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
}

/* Utilities */
.highlight {
    color: #ff4757;
    font-weight: bold;
}

.back-btn {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 25px;
    margin-bottom: 20px;
    font-weight: 600;
    transition: background 0.3s;
}

.back-btn:hover {
    background: #333;
}

/* Network Diagram (Tree) */
.network-tree {
    display: flex;
    flex-direction: row;
    /* Change to row */
    align-items: flex-start;
    gap: 40px;
    margin: 40px 0;
    padding: 30px;
    background: #fdfdfd;
    border-radius: 12px;
    border: 1px solid #eee;
}

.tree-avatar {
    width: 150px;
    /* Increased size */
    height: 150px;
    /* Increased size */
    flex-shrink: 0;
    position: sticky;
    top: 20px;
}

.tree-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tree-level {
    display: flex;
    justify-content: center;
    gap: 20px;
    position: relative;
    width: 100%;
    margin: 20px 0;
    flex-wrap: wrap;
}

.node {
    background: #fff;
    border: 2px solid var(--gold-color);
    color: #333;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    z-index: 2;
    min-width: 120px;
    text-align: center;
    position: relative;
}

.node.root {
    background: var(--gold-color);
    color: #333;
    font-size: 1.1rem;
    padding: 15px 30px;
    font-weight: 800;
}

/* Branch connector vertical */
.connector-v {
    width: 2px;
    height: 30px;
    background: #ccc;
    margin: 0 auto;
}

/* Badge styles for ranks */
.rank-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: #eee;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    color: #666;
    margin-right: 8px;
}

.rank-1,
.rank-2,
.rank-3 {
    background: var(--gold-color);
    color: #333;
}

/* Simple visual tree using flexbox and pseudo elements for lines could be complex but let's stick to simple grouping first */
.tree-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 10px;
}

.tree-group-title {
    font-weight: bold;
    margin-bottom: 10px;
    padding: 5px 15px;
    border: 1px solid #ddd;
    border-radius: 15px;
    background: #f9f9f9;
}

.tree-children {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tree-child {
    font-size: 0.9rem;
    color: #555;
    padding: 3px 0;
}

/* Enhanced Footer */
.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-logo {
    height: 40px;
    margin-bottom: 10px;
}

.footer-info {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #555;
}

.footer-copyright {
    margin-top: 20px;
    font-size: 0.8rem;
    color: #888;
}

/* Character Avatars */
.char-profile-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 30px 0;
    padding: 20px;
    background: #fdfdfd;
    border-radius: 12px;
    border: 1px solid #eee;
}

.char-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
}

.char-avatar-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--accent-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 10px;
    background: #eee;
}

.char-avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.char-info {
    text-align: center;
}

.char-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
}

.char-role {
    font-size: 0.75rem;
    color: #666;
}

.tree-avatar {
    width: 100px;
    height: 100px;
    margin-bottom: 15px;
}

/* 
   Mobile Optimization & Responsive Design 
   Added for better publishing experience on Netlify
*/

/* 1. Handling Table Overflow on Mobile */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
    margin-bottom: 20px;
}
.table-scroll table {
    min-width: 600px; /* Force table to keep shape, triggering scroll */
}

/* 2. Responsive Media Queries */
@media (max-width: 768px) {
    /* Header Adjustments */
    header {
        padding: 30px 0;
    }
    header h1 {
        font-size: 1.8rem; /* Smaller title for mobile */
        padding: 0 15px;
    }
    .report-meta {
        font-size: 0.8rem;
        gap: 10px;
        padding: 0 10px;
    }
    
    /* Layout Adjustments */
    .container {
        padding: 15px;
    }
    .report-content {
        padding: 25px 15px; /* Reduce padding to save screen space */
    }

    /* Network Tree Stacking */
    .network-tree {
        flex-direction: column; /* Stack vertically on mobile */
        align-items: center;
        gap: 20px;
        padding: 20px;
    }
    .tree-avatar {
        position: static; /* Remove sticky on mobile */
        margin-bottom: 20px;
    }
    .tree-level {
        flex-direction: column; /* Stack branches vertically */
        gap: 15px;
    }
    .tree-group {
        width: 100%; /* Full width for better readability */
        margin: 0;
    }
    .connector-v {
        height: 20px; /* Shorter connectors */
    }

    /* Navigation Grid */
    .nav-grid {
        grid-template-columns: repeat(2, 1fr); /* Force 2 columns */
        gap: 10px;
    }
    .nav-btn {
        padding: 12px 5px;
        font-size: 0.9rem;
    }
    .nav-btn span.date {
        font-size: 0.95rem;
    }
    .nav-btn span.label {
        font-size: 0.75rem;
    }
}

/* Very Small Screens */
@media (max-width: 400px) {
    header h1 {
        font-size: 1.5rem;
    }
    .nav-grid {
        grid-template-columns: 1fr; /* 1 column for very narrow screens */
    }
}