:root {
    /* Color Palette - Rich Purple Theme */
    --primary: #6A1B9A;
    --primary-light: #9C4DCC;
    --primary-dark: #4A148C;
    --primary-gradient: linear-gradient(135deg, #6A1B9A 0%, #9C4DCC 50%, #AB47BC 100%);
    
    --accent: #AB47BC;
    --accent-gold: #FFB300;
    --accent-teal: #00897B;
    --accent-coral: #FF7043;
    
    --bg-main: #FAFAFA;
    --bg-surface: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-hover: #F3F4F6;
    --bg-dark: #1a1a2e;
    
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --text-light: #F9FAFB;
    
    --border: #E5E7EB;
    --border-light: #F3F4F6;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 40px -10px rgba(106, 27, 154, 0.25);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-card-hover: 0 12px 40px rgba(106, 27, 154, 0.2);
    
    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    
    /* Transitions */
    --trans-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --trans-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-main);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }

a { text-decoration: none; color: inherit; transition: var(--trans-fast); }
img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-purple { color: var(--primary); }
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== NAVIGATION ===== */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-light);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    gap: 2rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: 'Poppins', sans-serif;
    letter-spacing: -0.5px;
}

.logo a {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-links a {
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
}

.nav-links a:hover {
    color: var(--primary);
    background: rgba(106, 27, 154, 0.05);
}

.nav-links a.active {
    color: var(--primary);
    background: rgba(106, 27, 154, 0.1);
    font-weight: 600;
}

/* Hamburger toggle button — hidden on desktop */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-main);
    margin: 5px 0;
    border-radius: 2px;
    transition: var(--trans-fast);
}

.nav-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: var(--trans-smooth);
    text-decoration: none;
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(106, 27, 154, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(106, 27, 154, 0.4);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--trans-smooth);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* ===== HERO SECTION ===== */
.hero {
    background: var(--primary-gradient);
    padding: 5rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero .container { position: relative; z-index: 1; }

.hero h1 {
    color: white;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    background: none;
    -webkit-text-fill-color: white;
}

.hero p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 650px;
    margin: 0 auto 2.5rem;
    line-height: 1.8;
}

.hero .btn {
    background: white;
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.hero .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.hero-compact { padding: 3rem 0; }
.hero-compact h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 0.75rem; }
.hero-compact p { font-size: 1.1rem; margin-bottom: 0; }

/* ===== SECTIONS ===== */
.section { padding: 5rem 0; }

.section-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.section-header h2 { margin-bottom: 1rem; }

.section-header p {
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    font-size: 1.1rem;
}

/* ===== GRID LAYOUTS ===== */
.grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== MODERN FLUID CARDS ===== */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--trans-smooth);
    border: 1px solid transparent;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(106, 27, 154, 0.1);
}

/* Poem Cards - Fluid Design */
.poem-card {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    padding: 0;
    border: none;
}

.poem-card .card-image {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.poem-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.poem-card:hover .card-image img {
    transform: scale(1.08);
}

.poem-card .card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.3) 40%, rgba(0, 0, 0, 0.85) 100%);
    z-index: 1;
}

.poem-card .card-content {
    position: relative;
    z-index: 2;
    padding: 1.5rem;
    margin-top: auto;
    color: white;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.poem-card .card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
    backdrop-filter: blur(10px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-akam { background: rgba(156, 39, 176, 0.85); }
.badge-puram { background: rgba(46, 125, 50, 0.85); }
.badge-mix { background: rgba(255, 143, 0, 0.85); }

.poem-card h3 {
    color: white;
    font-size: 1.5rem;
    margin: 0;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.poem-card .tamil-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
}

.poem-card .card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    flex-wrap: wrap;
}

.poem-card .card-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.poem-card .card-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.poem-card .card-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    opacity: 0.9;
    transition: var(--trans-fast);
}

.poem-card:hover .card-action {
    opacity: 1;
    gap: 0.75rem;
}

/* Thinai Cards - Fluid Design */
.thinai-card {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    min-height: 320px;
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    border: none;
}

.thinai-card .card-image {
    position: absolute;
    inset: 0;
}

.thinai-card .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.thinai-card:hover .card-image img {
    transform: scale(1.1);
}

.thinai-card .card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.7) 100%);
    transition: var(--trans-smooth);
}

.thinai-card:hover .card-overlay {
    background: linear-gradient(180deg, rgba(106, 27, 154, 0.3) 0%, rgba(74, 20, 140, 0.85) 100%);
}

.thinai-card .card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    color: white;
    z-index: 2;
}

.thinai-card h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.thinai-card .landscape {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-bottom: 1rem;
}

.thinai-card .theme-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Feature Cards */
.feature-card {
    padding: 2rem;
    text-align: center;
    border-radius: var(--radius-xl);
    background: white;
    border: 1px solid var(--border);
}

.feature-card:hover { border-color: var(--primary-light); }

.feature-card .icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
    border-radius: var(--radius-lg);
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--primary-dark);
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ===== TAGS ===== */
.tag {
    display: inline-block;
    padding: 0.3em 0.85em;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.tag-akam { background: #F3E5F5; color: #6A1B9A; }
.tag-puram { background: #E8F5E9; color: #2E7D32; }
.tag-mix { background: #FFF8E1; color: #F57F17; }

/* ===== STATS SECTION ===== */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 4rem;
    flex-wrap: wrap;
    padding: 3rem 0;
}

.stat-item { text-align: center; }

.stat-number {
    font-size: 3.5rem;
    font-weight: 800;
    font-family: 'Poppins', sans-serif;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.stat-label {
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* ===== INFO LIST ===== */
.info-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-list li {
    display: flex;
    gap: 0.5rem;
    font-size: 0.95rem;
    margin-bottom: 0;
}

.info-label {
    font-weight: 600;
    color: var(--primary);
    min-width: 100px;
}

/* ===== VERSE STYLES ===== */
.verse-container {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-card);
    margin-bottom: 2rem;
}

.tamil-verse {
    font-family: 'Noto Sans Tamil', 'Mukta Malar', sans-serif;
    font-size: 1.4rem;
    line-height: 2.2;
    color: var(--primary-dark);
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    margin-bottom: 2rem;
    white-space: pre-line;
}

.translation-block {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: var(--bg-main);
    border-radius: var(--radius-md);
}

.entity-pill {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    background: linear-gradient(135deg, #E0F7FA, #B2EBF2);
    color: #00695C;
    border-radius: 999px;
    font-size: 0.85rem;
    margin: 0.25rem;
}

/* ===== CTA SECTION ===== */
.cta-section {
    background: linear-gradient(135deg, #E8EAF6 0%, #E1F5FE 100%);
    padding: 4rem 2rem;
    text-align: center;
    border-radius: var(--radius-xl);
    margin: 2rem 0;
}

.cta-section h2 { margin-bottom: 1rem; }

.cta-section p {
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto 2rem;
}

/* ===== FOOTER ===== */
footer {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand .logo { margin-bottom: 1rem; }
.footer-brand .logo a { color: white; -webkit-text-fill-color: white; }

.footer-brand p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    line-height: 1.7;
}

.footer-links h4 {
    color: white;
    font-size: 1rem;
    margin-bottom: 1.25rem;
    font-weight: 600;
}

.footer-links ul {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
}

.footer-links a:hover { color: white; }

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9rem;
}

/* Simple footer fallback */
footer.simple {
    text-align: center;
    padding: 2rem 0;
}

/* ===== POEM DETAIL PAGE ===== */

/* Verse Navigation */
.verse-nav-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.verse-num {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-weight: 500;
    text-decoration: none;
    transition: var(--trans-fast);
    font-size: 0.9rem;
    cursor: pointer;
}

.verse-num:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.verse-num.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.verse-num.disabled {
    opacity: 0.4;
    cursor: default;
}

.verse-num.disabled:hover {
    background: var(--bg-main);
    color: var(--text-main);
    border-color: var(--border);
    transform: none;
}

.verse-display {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid var(--border);
    display: none;
}

.verse-display.visible {
    display: block;
}

.verse-tamil {
    font-family: 'Noto Sans Tamil', sans-serif;
    font-size: 1.2rem;
    line-height: 2;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary);
    white-space: pre-line;
}

.search-highlight {
    background: #FFD54F;
    color: #333;
    border-radius: 2px;
    padding: 0 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.verse-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.verse-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.verse-meta-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.verse-meta-value {
    font-weight: 600;
    color: var(--primary);
}

/* Old card support (deprecated - use poem-card or thinai-card) */
.card.legacy {
    padding: 1.5rem;
    border: 1px solid var(--border);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-surface);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
}

tr:hover { background-color: rgba(106, 27, 154, 0.05); cursor: pointer; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .footer-content { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid, .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 1rem 1.5rem;
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        gap: 0.25rem;
    }
    .nav-links.open { display: flex; }
    .nav-links a {
        padding: 0.75rem 1rem;
        width: 100%;
        border-radius: var(--radius-sm);
    }
    header .container nav { position: relative; }
    .hero { padding: 3rem 0; }
    .section { padding: 3rem 0; }
    .stats-row { gap: 2rem; }
    .stat-number { font-size: 2.5rem; }
    .footer-content { grid-template-columns: 1fr; gap: 2rem; }
    .cta-section { margin: 1rem 0; padding: 2rem 1rem; }
    .poem-card { min-height: 320px; }
    .thinai-card { min-height: 280px; }
}

/* ===== KNOWLEDGE GRAPH PAGE ===== */
.kg-page header {
    background: rgba(26, 26, 46, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.kg-page .logo a {
    color: white !important;
    -webkit-text-fill-color: white !important;
}

.kg-page .nav-links a {
    color: rgba(255, 255, 255, 0.7);
}

.kg-page .nav-links a:hover,
.kg-page .nav-links a.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.kg-page .nav-toggle span {
    background: white;
}

@media (max-width: 768px) {
    .kg-page .nav-links {
        background: rgba(26, 26, 46, 0.98);
    }
    .kg-page .nav-links a {
        color: rgba(255, 255, 255, 0.8);
    }
    .kg-page .nav-links a:hover,
    .kg-page .nav-links a.active {
        color: white;
        background: rgba(255, 255, 255, 0.15);
    }
}

/* Thinai image (legacy support) */
.thinai-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

/* ===== POEMS PAGE ===== */

.filter-btn {
    padding: 0.6rem 1.25rem;
    border: 2px solid var(--border);
    background: white;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--trans-fast);
    color: var(--text-muted);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.poem-card-new {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    transition: var(--trans-smooth);
    border: 1px solid var(--border);
}

.poem-card-new:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--primary-light);
}

.card-color-strip {
    height: 4px;
    width: 100%;
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card-badge-small {
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-akam { background: rgba(156, 39, 176, 0.15); color: #7B1FA2; }
.badge-puram { background: rgba(46, 125, 50, 0.15); color: #2E7D32; }
.badge-mix { background: rgba(255, 143, 0, 0.15); color: #E65100; }

.verse-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.poem-card-new h3 {
    font-size: 1.35rem;
    color: var(--text-main);
    margin: 0;
}

.poem-card-new .tamil-name {
    font-size: 1rem;
    color: var(--primary);
    font-family: 'Noto Sans Tamil', sans-serif;
}

.poem-card-new .card-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0.5rem 0;
    flex: 1;
}

.card-footer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.poet-name {
    font-weight: 500;
}

.poem-card-new .card-action {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.poem-card-new:hover .card-action {
    gap: 0.6rem;
}

/* ===== THINAI DETAIL PAGE ===== */

.detail-hero {
    height: 400px;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding-bottom: 3rem;
}

.detail-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.feature-box {
    background: #fff;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    text-align: center;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.gallery-item {
    text-align: center;
}

.gallery-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    background: #eee;
}

/* ===== KNOWLEDGE GRAPH DASHBOARD ===== */

.kg-hero {
    background: var(--primary-gradient);
    padding: 3rem 0;
    text-align: center;
}

.kg-hero h1 {
    font-size: 2.5rem;
    color: white;
    margin-bottom: 0.5rem;
}

.kg-hero .subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
}

.version-tag {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.kg-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.kg-stat {
    text-align: center;
}

.kg-stat-val {
    font-size: 2.25rem;
    font-weight: 700;
    color: white;
}

.kg-stat-label {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
}

.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.thinai-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.thinai-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    background: white;
    border: 3px solid var(--border);
    box-shadow: var(--shadow-md);
}

.thinai-circle:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-lg);
}

.thinai-circle.active {
    transform: scale(1.12);
    border-width: 4px;
}

.t-icon { font-size: 2rem; margin-bottom: 0.25rem; }
.t-name { font-weight: 700; font-size: 1rem; color: var(--text-main); }
.t-tamil { font-size: 0.8rem; color: var(--text-muted); }

.c-kurinji { border-color: #9C27B0; }
.c-kurinji.active { box-shadow: 0 0 30px rgba(156, 39, 176, 0.4); }
.c-mullai { border-color: #009688; }
.c-mullai.active { box-shadow: 0 0 30px rgba(0, 150, 136, 0.4); }
.c-marutam { border-color: #FF9800; }
.c-marutam.active { box-shadow: 0 0 30px rgba(255, 152, 0, 0.4); }
.c-neytal { border-color: #2196F3; }
.c-neytal.active { box-shadow: 0 0 30px rgba(33, 150, 243, 0.4); }
.c-palai { border-color: #FF5722; }
.c-palai.active { box-shadow: 0 0 30px rgba(255, 87, 34, 0.4); }

.c-all { border-color: #607D8B; }
.c-all.active { box-shadow: 0 0 30px rgba(96, 125, 139, 0.4); }

.content-area {
    display: none;
    grid-template-columns: 450px 1fr;
    gap: 2rem;
    min-height: 600px;
}

.content-area.visible {
    display: grid;
}

.sidebar {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: 650px;
    overflow-y: auto;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

.sidebar h3 {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.75rem;
    font-size: 1.1rem;
    color: var(--text-main);
}

.category-filter {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.cat-btn {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-muted);
    transition: all 0.2s;
}

.cat-btn:hover, .cat-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.entity-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.entity-card {
    background: var(--bg-main);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border);
}

.entity-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.entity-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 12px rgba(106, 27, 154, 0.3);
}

.e-img-container {
    width: 100%;
    height: 65px;
    background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.e-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.e-placeholder {
    font-size: 1.5rem;
    opacity: 0.5;
}

.e-info {
    padding: 0.5rem;
    text-align: center;
}

.e-word {
    font-weight: 600;
    font-size: 0.75rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.e-meaning {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.e-meaning-tamil {
    font-size: 0.6rem;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Noto Sans Tamil', sans-serif;
    opacity: 0.8;
}

.e-forms-badge {
    display: inline-block;
    background: var(--primary, #4CAF50);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 4px;
    vertical-align: middle;
    line-height: 1.4;
}

.kg-entity-forms {
    font-size: 0.78rem;
    color: var(--text-muted, #666);
    margin-top: 4px;
    font-family: 'Noto Sans Tamil', sans-serif;
    line-height: 1.5;
    word-break: break-word;
}

.main-view {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: 650px;
    overflow-y: auto;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

.main-view h3 {
    color: var(--text-main);
    margin-bottom: 1rem;
}

.verse-card {
    background: var(--bg-main);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border-left: 4px solid var(--border);
}

.verse-card.c-kurinji { border-left-color: #9C27B0; }
.verse-card.c-mullai { border-left-color: #009688; }
.verse-card.c-marutam { border-left-color: #FF9800; }
.verse-card.c-neytal { border-left-color: #2196F3; }
.verse-card.c-palai { border-left-color: #FF5722; }

.v-id {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.v-text {
    font-size: 1rem;
    line-height: 1.8;
    font-family: 'Noto Sans Tamil', sans-serif;
    color: var(--text-main);
}

.highlight {
    background: rgba(255, 179, 0, 0.25);
    color: #E65100;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
}

@media (max-width: 1050px) {
    .content-area {
        grid-template-columns: 1fr;
    }
    .sidebar {
        height: auto;
        max-height: 400px;
    }
    .main-view {
        height: auto;
        min-height: 400px;
    }
    .thinai-circle {
        width: 100px;
        height: 100px;
    }
    .t-icon { font-size: 1.5rem; }
    .t-name { font-size: 0.85rem; }
    .kg-stats { gap: 1.5rem; }
}

/* ===== GAMES HUB PAGE ===== */

.games-hero {
    background: var(--primary-gradient);
    padding: 4rem 0;
    text-align: center;
}

.games-hero h1 {
    color: white;
    margin-bottom: 1rem;
}

.games-hero p {
    color: rgba(255,255,255,0.9);
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 4rem 0;
}

.game-card {
    background: white;
    border-radius: var(--radius-xl);
    overflow: hidden;
    text-decoration: none;
    transition: var(--trans-smooth);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--primary-light);
}

.game-card-image {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    position: relative;
    overflow: hidden;
}

.game-card-image.thinai-quest {
    background: linear-gradient(135deg, #7B1FA2 0%, #E91E63 100%);
}

.game-card-image.trivia {
    background: linear-gradient(135deg, #FF9800 0%, #F44336 100%);
}

.game-card-image.match {
    background: linear-gradient(135deg, #2196F3 0%, #00BCD4 100%);
}

.game-card-image.puzzle {
    background: linear-gradient(135deg, #4CAF50 0%, #8BC34A 100%);
}

.game-card-content {
    padding: 1.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.game-card-content h3 {
    font-size: 1.35rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.game-card-content .tamil-name {
    color: var(--primary);
    font-size: 0.95rem;
    font-family: 'Noto Sans Tamil', sans-serif;
    margin-bottom: 1rem;
}

.game-card-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    flex: 1;
}

.game-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.difficulty {
    display: flex;
    gap: 3px;
}

.difficulty-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}

.difficulty-dot.active {
    background: var(--primary);
}

.play-btn {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.game-card:hover .play-btn {
    gap: 0.6rem;
}

.coming-soon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.game-card.disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.game-card.disabled:hover {
    transform: none;
    box-shadow: var(--shadow-card);
}

/* ===== THINAI QUEST GAME ===== */

:root {
    --kurinji: #9C27B0;
    --mullai: #009688;
    --marutam: #FF9800;
    --neytal: #2196F3;
    --palai: #FF5722;
}

.game-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    min-height: calc(100vh - 80px);
}

.start-screen {
    text-align: center;
    padding: 4rem 2rem;
}

.start-screen h1 {
    font-size: 3rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.start-screen .subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 3rem;
}

.rules-box {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 500px;
    margin: 0 auto 2.5rem;
    box-shadow: var(--shadow-card);
    text-align: left;
}

.rules-box h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.rules-box ul {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rules-box li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.rules-box li span.icon {
    font-size: 1.25rem;
}

.start-btn {
    padding: 1rem 3rem;
    font-size: 1.1rem;
}

.game-screen {
    display: none;
}

.game-screen.active {
    display: block;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.score-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Poppins', sans-serif;
}

.progress-display {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-text {
    font-weight: 600;
    color: var(--text-muted);
}

.progress-bar {
    width: 120px;
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

.verse-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-card);
}

.verse-source {
    display: inline-block;
    background: rgba(106, 27, 154, 0.1);
    color: var(--primary);
    padding: 0.35rem 1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.verse-source.visible {
    opacity: 1;
}

.verse-text {
    font-family: 'Noto Sans Tamil', sans-serif;
    font-size: 1.25rem;
    line-height: 2;
    color: var(--text-main);
    text-align: center;
    padding: 1rem 0;
    white-space: pre-line;
}

.hint-section {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.hint-btn {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    padding: 0.75rem 1rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--trans-fast);
    color: var(--text-muted);
}

.hint-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.hint-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-main);
}

.hint-btn.used {
    background: rgba(106, 27, 154, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

.hint-display {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: none;
    animation: slideDown 0.3s ease;
}

.hint-display.visible {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hint-display p {
    color: #5D4037;
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 0;
}

.entity-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(93, 64, 55, 0.2);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #5D4037;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.flora { background: #4CAF50; }
.legend-dot.fauna { background: #FF9800; }
.legend-dot.people { background: #2196F3; }
.legend-dot.landscape { background: #9C27B0; }

.options-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 700px) {
    .options-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--trans-fast);
    box-shadow: var(--shadow-sm);
}

.option-btn .icon {
    font-size: 1.75rem;
}

.option-btn .label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.option-btn:hover:not(:disabled) {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.option-btn.kurinji:hover { border-color: var(--kurinji); }
.option-btn.mullai:hover { border-color: var(--mullai); }
.option-btn.marutam:hover { border-color: var(--marutam); }
.option-btn.neytal:hover { border-color: var(--neytal); }
.option-btn.palai:hover { border-color: var(--palai); }

.option-btn.correct {
    background: #E8F5E9;
    border-color: #4CAF50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

.option-btn.wrong {
    background: #FFEBEE;
    border-color: #F44336;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.3);
}

.option-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.feedback-section {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-card);
    display: none;
    animation: slideDown 0.3s ease;
}

.feedback-section.visible {
    display: block;
}

.feedback-section.correct {
    border-left: 4px solid #4CAF50;
}

.feedback-section.wrong {
    border-left: 4px solid #F44336;
}

.feedback-title {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.feedback-title.correct { color: #2E7D32; }
.feedback-title.wrong { color: #C62828; }

.feedback-points {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.next-btn {
    padding: 0.75rem 2rem;
}

.result-screen {
    display: none;
    text-align: center;
    padding: 4rem 2rem;
}

.result-screen.active {
    display: block;
}

.result-screen h1 {
    font-size: 2.5rem;
    color: var(--text-main);
    margin-bottom: 2rem;
}

.final-score-box {
    background: white;
    border-radius: var(--radius-xl);
    padding: 3rem;
    max-width: 400px;
    margin: 0 auto 2rem;
    box-shadow: var(--shadow-card);
}

.final-score-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.final-score-value {
    font-size: 4rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}

.result-message {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hidden { display: none !important; }

/* ===========================================================================
   UTILITY CLASSES
   Extracted from inline styles across all pages
   =========================================================================== */

/* --- Layout --- */
.text-center { text-align: center; }
.m-0  { margin: 0; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.mb-05 { margin-bottom: 0.5rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-3 { margin-bottom: 3rem; }
.mb-4 { margin-bottom: 4rem; }
.pt-0 { padding-top: 0; }
.pt-2 { padding-top: 2rem; }
.pb-2 { padding-bottom: 2rem; }

.flex-center-wrap {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Typography --- */
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-primary-dark { color: var(--primary-dark); }

/* --- Common patterns --- */
.meta-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.meta-value {
    font-weight: 600;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 1rem;
}

.empty-state-lg {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.loading-text {
    text-align: center;
    color: var(--text-muted);
}

/* ===========================================================================
   COMPONENT CLASSES – HOME PAGE (index.html)
   =========================================================================== */

.hero-home {
    background: linear-gradient(rgba(106, 27, 154, 0.75), rgba(74, 20, 140, 0.85)),
                url('https://images.unsplash.com/photo-1582510003544-4d00b7f74220?auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
    min-height: 500px;
}

.section-white {
    background: white;
    padding: 4rem 0;
}

.section-alt {
    background: var(--bg-main);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.about-text {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
}

.stat-box-purple {
    background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
    padding: 3rem;
    border-radius: 28px;
}

.stat-box-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.icon-lg {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.stat-value-tamil {
    font-weight: 700;
    color: var(--primary-dark);
}

.stat-sublabel {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===========================================================================
   COMPONENT CLASSES – POEMS LIST (poems.html)
   =========================================================================== */

.filter-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.section-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.subtitle-muted {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* ===========================================================================
   COMPONENT CLASSES – POEM DETAIL (poem_detail.html)
   =========================================================================== */

.back-link-container {
    margin-top: 2rem;
}

.btn-pill {
    padding: 0.5rem 1rem;
    border-radius: 99px;
}

.verse-heading {
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

.verse-subtext {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.badge-pill {
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-size: 0.8rem;
    display: inline-block;
}

.badge-pill--primary {
    background: rgba(106, 27, 154, 0.1);
    color: var(--primary);
}

.badge-pill--green {
    background: rgba(46, 125, 50, 0.1);
    color: #2E7D32;
    margin-left: 0.5rem;
}

.poem-tamil-name {
    font-size: 1.4rem;
    color: var(--primary);
    font-family: 'Noto Sans Tamil', sans-serif;
    margin-bottom: 1.5rem;
}

.poem-description {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 800px;
}

.meta-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    background: var(--bg-main);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.trivia-box {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    border-left: 4px solid #4CAF50;
}

.coming-soon-box {
    margin-top: 2rem;
    padding: 2rem;
    background: #FFF9C4;
    border-radius: var(--radius-lg);
}

.coming-soon-note {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.translation-box {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #E3F2FD 0%, #BBDEFB 100%);
    border-radius: var(--radius-md);
    border-left: 4px solid #2196F3;
}

.translation-label {
    color: #1565C0;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.translation-text {
    line-height: 1.8;
    color: #333;
    white-space: pre-line;
}

.verse-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.btn-sm {
    font-size: 0.9rem;
}

/* ===========================================================================
   COMPONENT CLASSES – THINAI (thinai.html)
   =========================================================================== */

.intro-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.intro-text {
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--text-muted);
}

.thinai-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.thinai-card-meta {
    margin-top: 1rem;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ===========================================================================
   COMPONENT CLASSES – THINAI DETAIL (thinai_detail.html)
   =========================================================================== */

.loading-container {
    padding: 4rem;
}

.detail-hero-overlay {
    position: relative;
    z-index: 1;
    color: white;
}

.detail-back-link {
    color: rgba(255,255,255,0.8);
    margin-bottom: 1rem;
    display: inline-block;
}

.detail-title {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    color: white;
}

.detail-landscape {
    font-size: 1.5rem;
    opacity: 0.9;
}

.about-section {
    max-width: 900px;
    margin: 0 auto 3rem;
}

.about-heading {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.about-description {
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--text-main);
}

.feature-value-highlight {
    font-weight: 600;
    font-size: 1.1rem;
}

.feature-item-border {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
}

.sample-verse-box {
    background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 3rem;
}

.sample-verse-heading {
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
}

.sample-verse-text {
    font-family: 'Noto Sans Tamil', sans-serif;
    font-size: 1.2rem;
    line-height: 2;
    color: var(--text-main);
    margin-bottom: 1rem;
    padding-left: 1.5rem;
    border-left: 4px solid var(--primary);
}

.sample-verse-translation {
    color: var(--text-muted);
    font-style: italic;
    padding-left: 1.5rem;
}

.features-container {
    max-width: 600px;
    margin: 0 auto 3rem;
}

.features-heading {
    text-align: center;
    margin-bottom: 1.5rem;
}

.features-list {
    list-style: none;
    padding: 1.5rem 2rem;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.explore-footer {
    text-align: center;
    border-top: 1px solid var(--border);
    padding-top: 2rem;
}

.explore-footer-text {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* ===========================================================================
   COMPONENT CLASSES – KNOWLEDGE GRAPH
   =========================================================================== */

.kg-error-box {
    display: none;
    background: #ffebee;
    border: 1px solid #f44336;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.kg-error-title {
    color: #c62828;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.kg-error-message {
    color: #666;
    font-size: 0.9rem;
}

.kg-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.kg-filter-bar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(0,0,0,0.04);
    border-radius: 8px;
}

/* Unified Category Bar */
.kg-category-bar {
    display: none;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.6rem 0.75rem;
    background: rgba(0,0,0,0.03);
    border-radius: 10px;
}
.content-area.visible ~ .kg-category-bar,
.kg-category-bar:has(~ .content-area.visible) {
    display: flex;
}
/* Show when content area is visible — JS-driven fallback */
.kg-category-bar.visible {
    display: flex;
}

.kg-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 2px solid var(--border);
    background: white;
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.kg-cat-pill:hover {
    border-color: #6A1B9A;
    box-shadow: 0 2px 8px rgba(106, 27, 154, 0.15);
}
.kg-cat-pill.active {
    background: #6A1B9A;
    color: #fff;
    border-color: #6A1B9A;
}

.kg-cat-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.kg-cat-pill.active .kg-cat-dot {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.5);
}

.kg-entity-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.kg-detail-item {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
}

.kg-detail-name {
    color: var(--accent-color);
    font-weight: 600;
}

.kg-detail-meaning {
    color: var(--text-muted);
}

.kg-detail-category {
    color: var(--accent-color, #6A1B9A);
    font-weight: 600;
}

.kg-verse-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.kg-verse-source {
    color: #6A1B9A;
    font-weight: 600;
    font-size: 0.9rem;
}

.kg-verse-badge {
    background: #e8e8e8;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #666;
}

.kg-verse-text-tamil {
    font-family: 'Noto Sans Tamil', sans-serif;
    line-height: 1.9;
    color: #333;
    font-size: 1rem;
    white-space: pre-line;
}

.kg-verse-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
}

/* KG Poem Filter Pills */
.kg-poem-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    align-items: center;
}

.kg-poem-ctrl {
    display: flex;
    gap: 0.35rem;
    margin-right: 0.5rem;
}

.kg-poem-ctrl-btn {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--trans-fast);
}
.kg-poem-ctrl-btn:hover {
    background: #6A1B9A;
    color: #fff;
    border-color: #6A1B9A;
}

.kg-poem-pill {
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 2px solid var(--border);
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--trans-fast);
    text-align: center;
    opacity: 0.5;
}
.kg-poem-pill:hover { opacity: 0.8; }
.kg-poem-pill.selected {
    background: #6A1B9A;
    color: #fff;
    border-color: #6A1B9A;
    opacity: 1;
}

.kg-verse-tamil-name {
    font-family: 'Noto Sans Tamil', sans-serif;
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 0.3rem;
}

.kg-accent-text {
    color: var(--accent-color);
}

.kg-entity-card-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.kg-entity-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.kg-entity-name {
    color: var(--text-light);
    margin: 0;
    font-size: 1.3rem;
}

.kg-entity-subtitle {
    color: var(--text-muted);
    margin: 0.25rem 0 0 0;
}

.kg-entity-link {
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* ===========================================================================
   COMPONENT CLASSES – THINAI QUEST GAME
   =========================================================================== */

.hint-content-item {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.hint-content-item--preline {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    white-space: pre-line;
}

.entity-tag {
    background: rgba(106, 27, 154, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px;
    display: inline-block;
}

/* Dynamic highlight (used in KG with color param) */
.kg-highlight-tag {
    color: white;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-weight: 500;
}

/* ===== VERSES BROWSER PAGE ===== */

/* Poem Selector */
.verses-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.verses-section-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-main);
}

.poem-pills-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Pattupattu: force 5+5 grid on desktop */
#pattupattu-pills {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}
@media (max-width: 768px) {
    #pattupattu-pills {
        grid-template-columns: repeat(2, 1fr);
    }
}

.poem-pill {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    border: 2px solid transparent;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--trans-fast);
    text-decoration: none;
    display: inline-block;
    line-height: 1.3;
    text-align: center;
}

.pill-tamil {
    display: block;
    font-size: 0.68rem;
    opacity: 0.75;
    font-family: 'Noto Sans Tamil', sans-serif;
    line-height: 1.2;
    margin-top: 1px;
}
.poem-pill.selected .pill-tamil { opacity: 0.9; }

.poem-pill--akam {
    background: #F3E5F5;
    color: #6A1B9A;
    border-color: #CE93D8;
}
.poem-pill--akam.selected {
    background: #6A1B9A;
    color: #fff;
    border-color: #6A1B9A;
}

.poem-pill--puram {
    background: #FBE9E7;
    color: #BF360C;
    border-color: #FF8A65;
}
.poem-pill--puram.selected {
    background: #E65100;
    color: #fff;
    border-color: #E65100;
}

.poem-pill--mix {
    background: #E0F2F1;
    color: #004D40;
    border-color: #80CBC4;
}
.poem-pill--mix.selected {
    background: #00695C;
    color: #fff;
    border-color: #00695C;
}

.select-all-btn {
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--trans-fast);
}
.select-all-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.select-all-btn.all-on {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Thinai Filter Pills */
.thinai-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.thinai-pill {
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--trans-fast);
    border: 2px solid transparent;
    opacity: 0.7;
    text-align: center;
}
.thinai-pill:hover { opacity: 1; }
.thinai-pill.active {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.15);
}

.thinai-pill--kurinji  { background: #D7CCC8; color: #4E342E; border-color: #BCAAA4; }
.thinai-pill--mullai   { background: #C8E6C9; color: #1B5E20; border-color: #A5D6A7; }
.thinai-pill--marutam  { background: #FFF9C4; color: #F57F17; border-color: #FFF176; }
.thinai-pill--neithal  { background: #BBDEFB; color: #0D47A1; border-color: #90CAF9; }
.thinai-pill--palai    { background: #FFCDD2; color: #B71C1C; border-color: #EF9A9A; }

.thinai-pill--kurinji.active  { border-color: #5D4037; }
.thinai-pill--mullai.active   { border-color: #2E7D32; }
.thinai-pill--marutam.active  { border-color: #F57F17; }
.thinai-pill--neithal.active  { border-color: #1565C0; }
.thinai-pill--palai.active    { border-color: #C62828; }

/* Thinai-colored verse number buttons */
.verse-num.thinai-kurinji  { background: #D7CCC8; border-color: #BCAAA4; color: #4E342E; }
.verse-num.thinai-mullai   { background: #C8E6C9; border-color: #A5D6A7; color: #1B5E20; }
.verse-num.thinai-marutam  { background: #FFF9C4; border-color: #FFF176; color: #F57F17; }
.verse-num.thinai-neithal  { background: #BBDEFB; border-color: #90CAF9; color: #0D47A1; }
.verse-num.thinai-palai    { background: #FFCDD2; border-color: #EF9A9A; color: #B71C1C; }
.verse-num.thinai-none     { background: #F5F5F5; border-color: #E0E0E0; color: #757575; }

.verse-num.thinai-kurinji:hover,
.verse-num.thinai-mullai:hover,
.verse-num.thinai-marutam:hover,
.verse-num.thinai-neithal:hover,
.verse-num.thinai-palai:hover,
.verse-num.thinai-none:hover {
    filter: brightness(0.88);
    transform: translateY(-2px);
}

.verse-num.thinai-kurinji.active { background: #5D4037; color: #fff; border-color: #5D4037; }
.verse-num.thinai-mullai.active  { background: #2E7D32; color: #fff; border-color: #2E7D32; }
.verse-num.thinai-marutam.active { background: #F57F17; color: #fff; border-color: #F57F17; }
.verse-num.thinai-neithal.active { background: #1565C0; color: #fff; border-color: #1565C0; }
.verse-num.thinai-palai.active   { background: #C62828; color: #fff; border-color: #C62828; }
.verse-num.thinai-none.active    { background: #616161; color: #fff; border-color: #616161; }

/* Search Row */
.search-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.search-input-wrap {
    position: relative;
    flex: 1 1 200px;
}
.search-row input {
    width: 100%;
    padding: 0.55rem 2.2rem 0.55rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--trans-fast);
    box-sizing: border-box;
}
.search-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(106, 27, 154, 0.12);
}
.search-clear-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border: none;
    background: #ccc;
    color: #fff;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s;
}
.search-clear-btn:hover { background: #999; }
.search-clear-btn.visible { display: flex; }

/* Poem group heading inside verse grid */
.poem-group-heading {
    width: 100%;
    margin: 1.5rem 0 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}
.poem-group-heading:first-child {
    margin-top: 0;
}
.poem-group-heading .tamil-sub {
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.5rem;
}
.poem-group-heading .verse-count-label {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-left: 0.25rem;
}

/* Empty state for no results */
.no-results-msg {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Poem metadata card in verses page */
.poem-meta-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
}
.poem-meta-card h2 {
    margin: 0 0 0.15rem;
    font-size: 1.3rem;
}
.poem-meta-card .tamil-name-lg {
    font-family: 'Noto Sans Tamil', sans-serif;
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}
.poem-meta-card .meta-grid {
    gap: 1rem;
}

/* Verses page selector panel */
.selector-panel {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.master-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
