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

body {
    font-family: 'Georgia', serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #e4e4e4;
    line-height: 1.6;
}

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

header {
    text-align: center;
    padding: 40px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitle {
    color: #8892b0;
    font-style: italic;
    font-size: 1.1rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.tab {
    padding: 12px 24px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #8892b0;
    cursor: pointer;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.tab:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.tab.active {
    background: rgba(100, 255, 218, 0.1);
    border-color: #64ffda;
    color: #64ffda;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Chapter List */
.chapter-list {
    display: grid;
    gap: 15px;
}

.chapter-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chapter-card:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(100, 255, 218, 0.3);
    transform: translateX(5px);
}

.chapter-card h3 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.chapter-card .preview {
    color: #8892b0;
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chapter-card .meta {
    display: flex;
    gap: 15px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.chapter-card .meta span {
    font-size: 0.8rem;
    color: #64ffda;
    background: rgba(100, 255, 218, 0.1);
    padding: 4px 10px;
    border-radius: 20px;
}

/* Themes Cloud */
.themes-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.theme-tag {
    padding: 10px 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.theme-tag:hover {
    background: rgba(100, 255, 218, 0.15);
    border-color: #64ffda;
    color: #64ffda;
}

.theme-tag .count {
    margin-left: 8px;
    opacity: 0.6;
    font-size: 0.85rem;
}

/* Nouns List */
.search-box {
    margin-bottom: 25px;
}

.search-box input {
    width: 100%;
    padding: 15px 20px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 1rem;
}

.search-box input::placeholder {
    color: #8892b0;
}

.search-box input:focus {
    outline: none;
    border-color: #64ffda;
}

.nouns-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.noun-item {
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.noun-item:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(100, 255, 218, 0.3);
}

.noun-item .noun-name {
    color: #fff;
    font-weight: 500;
}

.noun-item .noun-count {
    color: #64ffda;
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Connections */
.connections-list {
    display: grid;
    gap: 20px;
}

.connection-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 20px;
}

.connection-card h4 {
    color: #64ffda;
    margin-bottom: 10px;
}

.connection-card .connection-type {
    color: #8892b0;
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 10px;
}

.connection-card .shared-elements {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.connection-card .shared-elements span {
    background: rgba(100, 255, 218, 0.1);
    color: #64ffda;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    margin: 40px auto;
    padding: 30px;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #8892b0;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #fff;
}

#modal-body h2 {
    color: #fff;
    margin-bottom: 20px;
    padding-right: 40px;
}

#modal-body .summary {
    color: #e4e4e4;
    margin-bottom: 25px;
    white-space: pre-wrap;
}

#modal-body .section {
    margin-bottom: 25px;
}

#modal-body .section h3 {
    color: #64ffda;
    font-size: 1rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#modal-body .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#modal-body .tag {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #e4e4e4;
    cursor: pointer;
    transition: all 0.2s;
}

#modal-body .tag:hover {
    background: rgba(100, 255, 218, 0.1);
    border-color: #64ffda;
    color: #64ffda;
}

#modal-body .connection-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

#modal-body .connection-item:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(100, 255, 218, 0.3);
}

#modal-body .connection-item h4 {
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 5px;
}

#modal-body .connection-item p {
    color: #8892b0;
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .tabs {
        gap: 8px;
    }

    .tab {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .modal-content {
        padding: 20px;
        margin: 20px auto;
    }

    .nouns-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* Definition Box */
.definition-box {
    background: rgba(100, 255, 218, 0.08);
    border: 1px solid rgba(100, 255, 218, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.definition-box h4 {
    color: #64ffda;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.definition-box p {
    color: #e4e4e4;
    line-height: 1.7;
    font-size: 1rem;
}

/* Term Header */
.term-header {
    display: flex;
    align-items: baseline;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.term-header h3 {
    color: #fff;
    font-size: 1.5rem;
    margin: 0;
}

.term-count {
    color: #8892b0;
    font-size: 0.9rem;
}

.section-label {
    color: #8892b0;
    font-size: 0.9rem;
    margin: 20px 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Read Original Button */
.read-original-btn {
    display: inline-block;
    background: rgba(100, 255, 218, 0.1);
    border: 1px solid #64ffda;
    color: #64ffda;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.read-original-btn:hover {
    background: rgba(100, 255, 218, 0.2);
    transform: translateX(5px);
}

/* Loading State */
.loading {
    text-align: center;
    padding: 60px;
    color: #8892b0;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #64ffda;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
