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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #d8e0ea;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding: 20px 16px;
    /* 适配全面屏 Safe Area */
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    
    font-family: "Noto Serif SC", "Songti SC", "STSong", "MingLiU", serif;
    color: #2b333e;
    touch-action: pan-y;
    
    /* 允许用户选中文字 */
    user-select: text;
    -webkit-user-select: text;
    
    position: relative;
}

/* 边缘顶/底提示浮层 */
.notice-tip {
    position: fixed; 
    left: 50%; 
    transform: translateX(-50%); 
    font-size: 0.8rem;
    color: #667085; 
    letter-spacing: 1px; 
    opacity: 0; 
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease; 
    z-index: 9999; 
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px); 
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 16px; 
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    white-space: nowrap;
    /* 提示文本不触发选中 */
    user-select: none;
    -webkit-user-select: none;
}
.notice-tip.top { 
    top: max(15px, env(safe-area-inset-top)); 
    transform: translateX(-50%) translateY(-10px); 
}
.notice-tip.top.show { 
    opacity: 1; 
    transform: translateX(-50%) translateY(0); 
}
.notice-tip.bottom { 
    bottom: max(15px, env(safe-area-inset-bottom)); 
    transform: translateX(-50%) translateY(10px); 
}
.notice-tip.bottom.show { 
    opacity: 1; 
    transform: translateX(-50%) translateY(0); 
}

/* 卡片舞台容器 */
#card-stage {
    width: 100%;
    max-width: 440px;
    display: flex;
    justify-content: center;
    align-items: center;
    will-change: transform, opacity;
    margin: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s;
}

#card-stage.show {
    opacity: 1;
    visibility: visible;
}

/* 确保舞台内的卡片不会溢出屏幕高度 */
#card-stage > div {
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
}

/* 底部操作提示文案 - 初始隐藏 */
.external-hint-box {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom));
    font-size: 0.82rem;
    color: #4b5563;
    font-family: system-ui, -apple-system, sans-serif;
    letter-spacing: 1px;
    opacity: 0; 
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s;
    animation: bounce 1.8s infinite;
    pointer-events: none;
    z-index: 100;
    text-align: center;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
}

.external-hint-box.show {
    opacity: 0.85;
    visibility: visible;
}

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

/* 加载状态指示器 */
#loading { 
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.4s ease, visibility 0.4s;
    user-select: none;
    -webkit-user-select: none;
}

#loading.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#loading svg {
    width: 80px;
    height: auto;
    display: block;
}

@media (max-height: 660px) {
    .external-hint-box {
        display: none;
    }
}
