:root {
    --bg-color: #f8f9fc;
    --text-color: #2d3748;
    --header-bg: #ffffff;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --accent-color: #4f46e5;
    --accent-hover: #4338ca;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    --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 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --text-muted: #666666;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --text-color: #f1f5f9;
        --header-bg: #1e293b;
        --card-bg: #1e293b;
        --card-border: #334155;
        --accent-color: #6366f1;
        --accent-hover: #818cf8;
        --text-muted: #94a3b8;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

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

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo-icon {
    font-size: 1.8rem;
    line-height: 1;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover .logo-icon {
    transform: scale(1.1) rotate(5deg);
}

.search-form {
    display: flex;
    align-items: center;
}

.search-form input {
    padding: 0.6rem 1rem;
    border: 1px solid var(--card-border);
    border-radius: 8px 0 0 8px;
    font-size: 0.95rem;
    background: var(--bg-color);
    color: var(--text-color);
    outline: none;
    width: 200px;
    font-family: var(--font-family);
}

.search-form input:focus {
    border-color: var(--accent-color);
    background: var(--card-bg);
}

.search-form button {
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--card-border);
    border-left: none;
    background: var(--accent-color);
    color: white;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.search-form button:hover {
    background: var(--accent-hover);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 5rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 24px;
    margin-bottom: 3rem;
    box-shadow: 0 10px 30px rgba(118, 75, 162, 0.2);
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    margin-bottom: 2.5rem;
    font-weight: 400;
}

.hero-description {
    max-width: 650px;
    margin: 2.5rem auto 0;
    font-size: 1.1rem;
    line-height: 1.7;
    opacity: 0.9;
}

/* Hero Search Form */
.hero-search-form {
    display: flex;
    max-width: 600px;
    margin: 2rem auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 50px;
    overflow: hidden;
    background: white;
    padding: 0.5rem;
}

.hero-search-form input {
    flex: 1;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    outline: none;
    font-family: var(--font-family);
    color: #333;
    /* Always dark text in white input */
}

.hero-search-form button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 40px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.hero-search-form button:hover {
    background: var(--accent-hover);
}

/* Intro Content Section */
.intro-content {
    max-width: 1000px;
    margin: 0 auto 4rem;
    padding: 3rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.intro-content p {
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Intro Grid */
.intro-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.intro-text h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.intro-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.intro-feature {
    background: var(--bg-color);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid var(--card-border);
}

.if-icon {
    font-size: 1.5rem;
}

@media (max-width: 768px) {
    .intro-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.intro-content a {
    color: var(--accent-color);
    font-weight: 500;
}

/* Categories Section */
.categories {
    margin-bottom: 3rem;
}

.categories h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.section-intro {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.05rem;
}

/* Browse Versions Section */
.browse-versions {
    margin-bottom: 3rem;
}

.browse-versions h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.version-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
}

.version-link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.version-link-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
    text-decoration: none;
}

.version-link-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.version-link-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.version-link-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
}

/* Category Header (for category pages) */
.category-header {
    text-align: center;
    padding: 2.5rem 1rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    border-radius: 12px;
}

.category-header h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

.category-description {
    max-width: 700px;
    margin: 0 auto 1rem;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #555;
}

.category-stats {
    color: var(--accent-color);
    font-size: 1.15rem;
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    .category-header {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }

    .intro-content p,
    .category-description {
        color: #bbb;
    }

    .version-card {
        background: #1e1e2e;
        border-color: #333;
    }

    .version-info {
        background: #1e1e2e;
        border-color: #333;
    }

    .info-content {
        color: #bbb;
    }
}

/* Version Index Pages */
.version-index-header {
    text-align: center;
    padding: 3rem 1rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border-radius: 16px;
}

.version-index-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.version-intro {
    max-width: 650px;
    margin: 0 auto;
    font-size: 1.1rem;
    opacity: 0.95;
    line-height: 1.6;
}

.version-list {
    margin-bottom: 3rem;
}

.version-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.version-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.version-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color);
    text-decoration: none;
}

.version-number {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--accent-color);
}

.version-count {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.version-info {
    max-width: 900px;
    margin: 0 auto 2rem;
    padding: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
}

.version-info h2 {
    margin-top: 0;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.info-content {
    line-height: 1.8;
    color: var(--text-muted);
}

.info-content p {
    margin-bottom: 1rem;
}

.info-content p:last-child {
    margin-bottom: 0;
}

.breadcrumb ol {
    list-style: none;
    padding: 0;
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumb li::after {
    content: "/";
    margin-left: 0.5rem;
    color: #ccc;
}

.breadcrumb li:last-child::after {
    content: "";
}

/* Grids */
.category-grid,
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.category-card,
.emoji-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    box-shadow: var(--shadow-sm);
    height: 100%;
    /* Ensure equal height */
    box-sizing: border-box;
    cursor: pointer;
}

.category-card h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.emoji-char {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.emoji-name {
    display: block;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    color: var(--text-muted);
}

.category-card:hover,
.emoji-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
    text-decoration: none;
    z-index: 2;
}

/* Tooltip Styles */
.emoji-card {
    position: relative;
    /* Anchor for absolute tooltip */
}

.tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--text-color);
    color: var(--bg-color);
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem;
    position: absolute;
    z-index: 1;
    bottom: 110%;
    /* Place above */
    left: 50%;
    margin-left: -100px;
    /* Center */
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    pointer-events: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);

    /* Max 2 lines Logic */
    box-sizing: border-box;
    height: auto;
}

.tooltip-content {
    display: block;
    /* Ensure it behaves like a block for line-clamp */
    line-height: 1.5;
    max-height: 3.0rem;
    /* 1.5 * 2 lines = 3.0rem. No padding here. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--text-color) transparent transparent transparent;
}

.emoji-card:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.emoji-char {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.emoji-name {
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Detail Page */
.emoji-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 2rem;
    justify-content: center;
    align-items: flex-start;
    /* Prevent stretching */
}

.emoji-large {
    font-size: 10rem;
    line-height: 1;
    background: var(--header-bg);
    padding: 2rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 320px;
    height: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 6rem;
    align-self: flex-start;
    /* Ensures it respects the start alignment for sticky behavior */
}

.emoji-info {
    flex: 1;
    min-width: 300px;
}

.btn-copy {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 4px;
    cursor: pointer;
    margin: 1rem 0;
    transition: background 0.2s;
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    padding: 0;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    margin-left: 0.5rem;
}

.btn-copy:hover {
    background: var(--accent-hover);
}

.emoji-meta table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.emoji-meta th,
.emoji-meta td {
    text-align: left;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--card-border);
}

/* Footer */
.main-footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid var(--card-border);
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .main-header {
        position: static;
        margin-bottom: 1rem;
    }

    .main-header .container {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero {
        padding: 3rem 1.5rem;
        border-radius: 16px;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }

    .category-grid,
    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 0.75rem;
    }

    .emoji-char {
        font-size: 2.5rem;
    }

    .logo {
        text-align: center;
        margin-bottom: 0;
    }

    .search-form {
        width: 100%;
    }

    .search-form input {
        flex: 1;
        min-width: 0;
    }

    .emoji-large {
        font-size: 6rem;
        width: 100%;
        height: auto;
        padding: 2rem 1rem;
        position: static;
        /* Disable sticky on mobile */
    }

    .tech-table th,
    .tech-table td {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .hero-search-form {
        max-width: 100%;
        width: 100%;
        margin: 1.5rem auto;
        padding: 0.25rem;
    }

    .hero-search-form input {
        padding: 0.6rem 0.5rem 0.6rem 1rem;
        font-size: 1rem;
        min-width: 0;
        /* Allow shrinking */
        width: 0;
        /* Flexbox trick */
    }

    .hero-search-form button {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
    }

    .intro-features {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .intro-content {
        padding: 1.5rem;
    }

    .version-links {
        grid-template-columns: 1fr;
    }
}

.section-block {
    margin-top: 2rem;
    padding: 1rem 0;
}

.section-block h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--card-border);
    padding-bottom: 0.5rem;
}

/* Tech Table */
.tech-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--card-border);
}

.tech-table th,
.tech-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.tech-table th {
    background: var(--header-bg);
    font-weight: 600;
    width: 40%;
}

.tech-table tr:last-child th,
.tech-table tr:last-child td {
    border-bottom: none;
}

/* FAQ */
.faq-section {
    margin-bottom: 3rem;
}

.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.faq-item h3 {
    margin-top: 0;
    font-size: 1.2rem;
    color: var(--accent-color);
}

.faq-item p {
    margin-bottom: 0;
}

/* Static Pages (About, How to Use) */
.static-page {
    max-width: 900px;
    margin: 0 auto;
}

.page-header {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-radius: 16px;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
}

.content-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.content-section h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.content-section p {
    line-height: 1.8;
    margin-bottom: 1rem;
}

.content-section ul,
.content-section ol {
    line-height: 1.8;
    padding-left: 1.5rem;
}

.content-section li {
    margin-bottom: 0.5rem;
}

.numbered-list {
    counter-reset: item;
    list-style: none;
    padding-left: 0;
}

.numbered-list li {
    counter-increment: item;
    margin-bottom: 1.5rem;
    padding-left: 3rem;
    position: relative;
}

.numbered-list li::before {
    content: counter(item);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.tip-box {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-top: 1.5rem;
}

@media (prefers-color-scheme: dark) {
    .tip-box {
        background: #3d3200;
        border-color: #665200;
    }
}

kbd {
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-family: monospace;
    font-size: 0.9rem;
}

@media (prefers-color-scheme: dark) {
    kbd {
        background: #333;
        border-color: #555;
    }
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.feature-card {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 12px;
}

.feature-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.feature-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.feature-card p {
    margin: 0;
    font-size: 0.95rem;
    color: #666;
}

/* Platform Comparison */
.platform-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.platform-item {
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 8px;
}

.platform-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-color);
    display: block;
    margin-bottom: 0.5rem;
}

.platform-item p {
    margin: 0;
    font-size: 0.95rem;
}

/* FAQ List */
.faq-list .faq-item {
    margin-bottom: 1rem;
}