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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

.header {
    background-color: #1a1a2e;
    color: white;
    padding: 10px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

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

.filter-section {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.filter-section h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #1a1a2e;
}

.filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.filter-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-button {
    padding: 8px 20px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.filter-button:hover {
    background-color: #357abd;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.result-count {
    font-size: 14px;
    color: #657786;
}

.embed-count {
    font-size: 14px;
    color: #4a90e2;
    font-weight: 500;
}

.tweet-list {
    display: grid;
    gap: 15px;
    width: 100%;
    max-width: 100%;
}

.tweet-item {
    background-color: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    word-wrap: break-word;
}

.tweet-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.tweet-meta {
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tag-category {
    background-color: #e3f2fd;
    color: #1976d2;
}

.tag-dungeon {
    background-color: #f3e5f5;
    color: #7b1fa2;
}

.tag-other {
    background-color: #fff3e0;
    color: #f57c00;
}

.tweet-date {
    font-size: 12px;
    color: #657786;
    margin-left: auto;
}

.tweet-text-preview {
    padding: 15px;
    background-color: #f8f9fa;
    border-left: 3px solid #4a90e2;
    border-radius: 4px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    word-wrap: break-word;
}

.tweet-text-preview .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.tweet-text-preview .user-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.tweet-text-preview .user-name {
    font-weight: 600;
    font-size: 14px;
}

.tweet-text-preview .user-id {
    font-size: 13px;
    color: #657786;
}

.tweet-text-preview .text-content {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    margin-bottom: 10px;
}

.tweet-text-preview .media-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #657786;
    margin-bottom: 10px;
}

.tweet-text-preview .load-embed-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #1da1f2;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.tweet-text-preview .load-embed-btn:hover {
    background-color: #1a8cd8;
}

.tweet-embed-container {
    position: relative;
    min-height: 200px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.twitter-tweet-rendered {
    transform: scale(0.9) !important;
    transform-origin: top left !important;
}

.tweet-item .tweet-embed-container {
    margin-bottom: -45px;
}

.twitter-tweet {
    max-width: 550px !important;
    margin: 0 !important;
}

.loading-message {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.scroll-top-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}

.scroll-top-button.visible {
    opacity: 1;
}

.scroll-top-button:hover {
    background-color: #357abd;
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 18px;
    }
    
    .container {
        margin: 10px auto;
        padding: 0 10px;
    }
    
    .filter-section {
        padding: 15px;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .filter-input {
        min-width: 100%;
    }
    
    .tweet-item {
        padding: 12px;
    }
    
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .twitter-tweet-rendered {
        transform: scale(0.95) !important;
    }
    
    .tweet-item .tweet-embed-container {
        margin-bottom: -25px;
    }
}