/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ===== App 容器 ===== */
#app {
    height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

/* ===== 页面切换 ===== */
.page {
    display: none;
    height: 100%;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 1;
    transition: opacity 0.3s ease;
}

.page.active {
    display: flex;
    z-index: 2;
}

/* ===== iframe 容器 ===== */
#page-frame {
    background: #fff;
}

#func-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

/* ===== 功能页面（iframe 内使用） ===== */
.func-page {
    height: 100vh;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

/* ===== 开始界面 ===== */
#page-start {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.start-container {
    text-align: center;
    padding: 40px 30px;
    width: 100%;
}

.app-logo {
    margin-bottom: 20px;
}

.logo-img {
    width: 100px;
    height: 100px;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.app-title {
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.app-subtitle {
    font-size: 16px;
    color: rgba(255,255,255,0.8);
    margin-bottom: 48px;
    letter-spacing: 4px;
}

.start-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 24px;
    border: none;
    border-radius: 16px;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: #fff;
    color: #667eea;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.btn-secondary {
    background: rgba(255,255,255,0.2);
    color: #fff;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
}

.btn-icon {
    font-size: 28px;
}

/* ===== 顶部栏 ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
    min-height: 56px;
}

.back-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #667eea;
    cursor: pointer;
    padding: 8px 4px;
    font-weight: 500;
    flex-shrink: 0;
}

.header-timer {
    flex: 1;
    text-align: center;
    font-size: 15px;
    color: #666;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.header-counter {
    font-size: 14px;
    color: #999;
    flex-shrink: 0;
}

/* ===== 内容区域 ===== */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    -webkit-overflow-scrolling: touch;
}

/* ===== 滚动条美化 ===== */
.content::-webkit-scrollbar {
    width: 4px;
}

.content::-webkit-scrollbar-track {
    background: transparent;
}

.content::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* ===== 动画 ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== 响应式适配 ===== */
@media (max-width: 360px) {
    .btn {
        font-size: 18px;
        padding: 16px 20px;
    }
    .app-title {
        font-size: 28px;
    }
}

@media (min-width: 768px) {
    #app {
        border-radius: 16px;
        margin-top: 20px;
        height: calc(100vh - 40px);
        max-height: 900px;
    }
    body {
        background: #e8e8e8;
    }
}
