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

:root {
    --primary-color: #6366f1;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 8px 20px rgba(0, 0, 0, 0.06);
    --golden-ratio: 1.618;
    --golden-ratio-inverse: 0.618;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.app-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

.app-container.dragging {
    cursor: grabbing;
}

/* 交互层 - 确保滑动事件能够触发 */
.app-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
}

/* 卡片容器 */
.cards-container {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
}

/* 单个卡片 */
.website-card {
    width: 100%;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: calc(60px + 20px) 20px 100px 20px;
    background: transparent;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s;
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    overflow: hidden;
}

.card-content {
    width: 100%;
    max-width: 540px;
    background: white;
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    display: flex;
    flex-direction: column;
}

.card-screenshot {
    width: 100%;
    height: calc(540px * var(--golden-ratio-inverse));
    background: #ffffff;
    border-radius: 12px;
    margin-bottom: calc(24px * var(--golden-ratio-inverse));
    overflow: hidden;
    position: relative;
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card-screenshot iframe {
    width: 125%;
    height: 125%;
    border: none;
    pointer-events: none;
    transform: scale(0.8);
    transform-origin: center center;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-left: -62.5%;
    margin-top: -62.5%;
}

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

.screenshot-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--text-secondary);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.webview-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-secondary);
    font-size: 14px;
}

.card-category {
    display: inline-block;
    padding: calc(6px * var(--golden-ratio-inverse)) calc(12px * var(--golden-ratio-inverse));
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: calc(12px * var(--golden-ratio-inverse));
    text-transform: uppercase;
}

.card-title {
    font-size: calc(24px * var(--golden-ratio));
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: calc(12px * var(--golden-ratio-inverse));
}

.card-domain {
    font-size: calc(14px * var(--golden-ratio-inverse));
    color: var(--text-secondary);
    margin-bottom: calc(16px * var(--golden-ratio-inverse));
}

.card-description {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: var(--golden-ratio);
    margin-bottom: calc(24px * var(--golden-ratio-inverse));
    max-height: calc(15px * var(--golden-ratio) * 3);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    flex: 0 0 auto;
}

.card-action {
    width: 100%;
    padding: calc(16px * var(--golden-ratio-inverse)) 32px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: auto;
    flex-shrink: 0;
}

.card-action:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

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

/* 顶部导航栏 */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    pointer-events: auto;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.category-filter {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-filter::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 滑动指示器 */
.scroll-indicator {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 50;
    animation: bounce 2s infinite;
    pointer-events: none;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
}

.indicator-text {
    color: white;
    font-size: 12px;
    opacity: 0.8;
}

@keyframes bounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-10px);
    }
}

/* 进度指示器 */
.progress-indicator {
    position: fixed;
    top: 70px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

/* 详情页模态框 */
.detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 200;
    transform: translateY(100%);
    -webkit-transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    -webkit-transition: -webkit-transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.detail-modal.active {
    transform: translateY(0);
    -webkit-transform: translateY(0);
}

.detail-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
    background: white;
}

.back-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
    padding: 0 20px;
}

.open-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.detail-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
}

.detail-info {
    margin-bottom: 24px;
}

.detail-screenshot {
    width: 100%;
    height: calc(100vw * var(--golden-ratio-inverse));
    max-height: 480px;
    background: #ffffff;
    border-radius: 16px;
    margin-bottom: calc(20px * var(--golden-ratio));
    overflow: hidden;
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.detail-screenshot iframe {
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: auto;
    position: absolute;
    top: 0;
    left: 0;
}

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

.detail-section {
    margin-bottom: 24px;
}

.detail-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.detail-section p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 6px 12px;
    background: var(--bg-light);
    border-radius: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* 响应式设计 - 平板端 */
@media (min-width: 768px) {
    .card-content {
        max-width: calc(540px * var(--golden-ratio));
        padding: calc(32px * var(--golden-ratio-inverse));
    }

    .card-screenshot {
        height: calc(540px * var(--golden-ratio-inverse) * var(--golden-ratio));
    }

    .card-title {
        font-size: calc(26px * var(--golden-ratio));
    }

    .card-description {
        font-size: calc(15px * var(--golden-ratio-inverse) + 1px);
        line-height: var(--golden-ratio);
    }

    .category-filter {
        gap: calc(8px * var(--golden-ratio));
    }

    .detail-content {
        max-width: calc(768px * var(--golden-ratio-inverse));
        margin: 0 auto;
        padding: calc(20px * var(--golden-ratio));
    }

    .detail-screenshot {
        height: calc(768px * var(--golden-ratio-inverse) * 0.8);
    }
}

/* 响应式设计 - PC端 */
@media (min-width: 1024px) {
    .app-container {
        cursor: grab;
        user-select: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
    }

    .card-content {
        max-width: calc(680px * var(--golden-ratio-inverse) + 100px);
        padding: calc(40px * var(--golden-ratio-inverse) + 10px);
    }

    .card-screenshot {
        height: calc(780px * var(--golden-ratio-inverse));
        border-radius: 16px;
    }

    .card-title {
        font-size: calc(32px * var(--golden-ratio));
        margin-bottom: calc(16px * var(--golden-ratio-inverse));
    }

    .card-domain {
        font-size: calc(15px * var(--golden-ratio-inverse) + 1px);
    }

    .card-description {
        font-size: 17px;
        line-height: calc(var(--golden-ratio) + 0.1);
        margin-bottom: calc(32px * var(--golden-ratio-inverse));
    }

    .card-action {
        padding: calc(18px * var(--golden-ratio-inverse)) 40px;
        font-size: 16px;
        border-radius: 14px;
    }

    .top-bar {
        height: calc(60px * var(--golden-ratio-inverse) + 23px);
        padding: 0 calc(20px * var(--golden-ratio));
    }

    .logo {
        font-size: calc(24px * var(--golden-ratio-inverse) + 9px);
    }

    .category-filter {
        gap: calc(10px * var(--golden-ratio-inverse) + 4px);
    }

    .filter-btn {
        padding: calc(8px * var(--golden-ratio-inverse) + 1px) calc(16px * var(--golden-ratio-inverse) + 6px);
        font-size: calc(14px * var(--golden-ratio-inverse) + 5px);
    }

    .progress-indicator {
        top: calc(70px * var(--golden-ratio-inverse) + 27px);
        right: calc(20px * var(--golden-ratio));
        font-size: calc(14px * var(--golden-ratio-inverse) + 5px);
    }

    .scroll-indicator {
        bottom: calc(40px * var(--golden-ratio));
    }

    .detail-content {
        max-width: calc(1024px * var(--golden-ratio-inverse));
        padding: calc(32px * var(--golden-ratio-inverse) + 12px);
    }

    .detail-screenshot {
        height: calc(1024px * var(--golden-ratio-inverse) * 0.7);
        max-height: calc(600px * var(--golden-ratio-inverse) + 229px);
    }

    .detail-section h3 {
        font-size: calc(18px * var(--golden-ratio-inverse) + 7px);
    }

    .detail-section p {
        font-size: calc(15px * var(--golden-ratio-inverse) + 6px);
        line-height: var(--golden-ratio);
    }
}

/* 响应式设计 - 大屏PC */
@media (min-width: 1440px) {
    .card-content {
        max-width: calc(800px * var(--golden-ratio-inverse) + 306px);
        padding: calc(56px * var(--golden-ratio-inverse) + 21px);
    }

    .card-screenshot {
        height: calc(900px * var(--golden-ratio-inverse));
    }

    .card-title {
        font-size: calc(36px * var(--golden-ratio));
    }

    .card-description {
        font-size: calc(17px * var(--golden-ratio-inverse) + 7px);
    }

    .detail-content {
        max-width: calc(1200px * var(--golden-ratio-inverse));
    }

    .detail-screenshot {
        height: calc(1200px * var(--golden-ratio-inverse) * 0.65);
    }
}

/* 触摸反馈 */
@media (hover: none) {
    .card-action:active {
        opacity: 0.8;
    }

    .filter-btn:active {
        opacity: 0.7;
    }
}

/* 移动端专用样式 */
@media (max-width: 767px) {
    .website-card {
        padding: 80px 16px 30px 16px;
    }

    .card-content {
        max-width: 100%;
        padding: 20px;
        display: flex;
        flex-direction: column;
        height: auto;
        max-height: calc(100vh - 110px);
    }

    .card-screenshot {
        height: 180px;
        margin-bottom: 12px;
        flex-shrink: 0;
    }

    .card-category {
        margin-bottom: 6px;
        font-size: 10px;
        padding: 4px 10px;
    }

    .card-title {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .card-domain {
        font-size: 11px;
        margin-bottom: 8px;
    }

    .card-description {
        font-size: 13px;
        line-height: 1.4;
        margin-bottom: 12px;
        max-height: none;
        -webkit-line-clamp: 2;
        flex: 0 1 auto;
        min-height: 36px;
        overflow: hidden;
    }

    .card-action {
        margin-top: 12px;
        padding: 12px 24px;
        font-size: 14px;
        flex-shrink: 0;
    }

    .scroll-indicator {
        display: none;
    }

    .indicator-text {
        font-size: 11px;
    }

    .progress-indicator {
        top: 65px;
        right: 16px;
        font-size: 12px;
        padding: 6px 12px;
    }

    .top-bar {
        height: 56px;
        padding: 0 16px;
    }

    .logo {
        font-size: 20px;
    }

    .category-filter {
        gap: 6px;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* 浏览器兼容性优化 */
@supports (-webkit-touch-callout: none) {
    /* iOS Safari 优化 */
    .app-container {
        height: -webkit-fill-available;
    }

    .website-card {
        height: -webkit-fill-available;
    }
}

/* Firefox 优化 */
@-moz-document url-prefix() {
    .card-screenshot iframe {
        image-rendering: -moz-crisp-edges;
    }
}

/* Edge 优化 */
@supports (-ms-ime-align: auto) {
    .card-content {
        -ms-overflow-style: none;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card-screenshot {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 减少动画（用户偏好） */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --bg-light: #1f2937;
        --border-color: #374151;
    }

    body {
        background: #111827;
    }

    .card-content {
        background: #1f2937;
        color: var(--text-primary);
    }

    .top-bar {
        background: rgba(31, 41, 55, 0.95);
    }

    .detail-modal {
        background: #1f2937;
    }

    .detail-header {
        background: #1f2937;
        border-bottom-color: var(--border-color);
    }
}
