body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #212227;
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url(https://storage.craftx.site/f1/BG.jpg) no-repeat center center;
    background-size: cover;
    opacity: 0.4;
    z-index: -1;
}

.app {
    max-width: 420px;
    margin: auto;
    padding: 16px;
    position: relative;
    min-height: 100vh;
}

.top {
    background: rgba(40, 40, 45, 0.9);
    border-radius: 20px;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    position: relative;
}

.brand {
    font-size: 22px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.brand:hover {
    opacity: 0.8;
}

.logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: flex-end;
}

.search-input {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    padding: 8px 15px;
    color: white;
    width: 0;
    opacity: 0;
    transition: all 0.3s ease;
    position: absolute;
    right: 50px;
}

.search-input.active {
    width: calc(100% - 120px);
    opacity: 1;
    position: static;
}

.search-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.search-icon {
    width: 20px;
    height: 20px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    flex: 1;
    min-width: 70px;
    text-align: center;
    padding: 8px;
    border-radius: 16px;
    background: rgba(50, 50, 55, 0.8);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.tab.active {
    background: rgba(70, 70, 75, 0.9);
    font-weight: bold;
}

.tab:hover {
    background: rgba(60, 60, 65, 0.9);
}

.content-container {
    min-height: 400px;
}

.card {
    background: rgba(45, 45, 50, 0.85);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transform: translateY(30px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.card.visible {
    opacity: 1;
    transform: translateY(0);
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.user-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 70%;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.user-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-name {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.share-icon {
    width: 20px;
    height: 20px;
}

.preview {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    margin-bottom: 12px;
    overflow: hidden;
}

.preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.title {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.page {
    background: rgba(50, 50, 55, 0.8);
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.3s ease;
    min-width: 40px;
    text-align: center;
}

.page.active {
    background: rgba(70, 70, 75, 0.9);
    font-weight: bold;
}

.page:hover {
    background: rgba(60, 60, 65, 0.9);
}

.footer {
    text-align: center;
    padding: 30px 0 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.footer:hover {
    opacity: 0.8;
}

.detail-view {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease;
}

.detail-content {
    max-width: 500px;
    margin: 40px auto;
    background: rgba(50, 50, 55, 0.95);
    border-radius: 20px;
    padding: 25px;
    position: relative;
    box-sizing: border-box;
    animation: slideUp 0.4s ease;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
}

.detail-content.open {
    transform: scale(1);
    opacity: 1;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.detail-header-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-detail-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.close-btn-icon {
    width: 20px;
    height: 20px;
}

.detail-share-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.detail-share-icon {
    width: 20px;
    height: 20px;
}

.detail-image {
    width: 100%;
    border-radius: 16px;
    margin-bottom: 20px;
    max-height: 300px;
    object-fit: contain;
}

.detail-title {
    font-size: 26px;
    text-align: center;
    margin-bottom: 15px;
    word-break: break-word;
    font-weight: bold;
}

.detail-description {
    font-size: 16px;
    margin-bottom: 25px;
    line-height: 1.6;
    word-break: break-word;
    text-align: center;
    padding: 0 10px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.code-section-title {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    margin: 15px 0 8px;
    color: #fff;
}

.action-btn {
    padding: 14px;
    border-radius: 10px;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(60, 60, 65, 0.9);
    color: #fff;
    font-weight: bold;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn img {
    width: 22px;
    height: 22px;
}

.youtube-btn {
    background: #d32f2f;
    color: white;
}

.link-btn, .tool-btn, .other-btn {
    background: rgba(60, 60, 65, 0.9);
    color: #fff;
}

.loading {
    text-align: center;
    padding: 40px 20px;
    font-size: 18px;
}

.error {
    text-align: center;
    padding: 40px 20px;
    color: #ff6b6b;
    font-size: 18px;
}

.empty {
    text-align: center;
    padding: 60px 20px;
    font-size: 16px;
    opacity: 0.7;
}

.scroll-helper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(60, 60, 65, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    opacity: 0;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.scroll-helper.visible {
    opacity: 1;
}

.scroll-helper-icon {
    width: 20px;
    height: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@media (max-width: 480px) {
    .app {
        padding: 10px;
    }
    .tab {
        min-width: 60px;
        font-size: 12px;
        padding: 6px;
    }
    .detail-content {
        margin: 20px auto;
        padding: 20px;
    }
    .detail-title {
        font-size: 22px;
    }
    .detail-description {
        font-size: 14px;
    }
    .action-btn {
        font-size: 14px;
        padding: 12px;
    }
    .search-input.active {
        width: calc(100% - 100px);
    }
}
