/* ==========================================
   全局设计系统 & 基础设置
   ========================================== */
:root {
    --bg-dark: var(--bg-color, #0b0914);
    --bg-darker: var(--bg-darker, #05040a);
    --primary: var(--primary-color, #ff2a74);
    --primary-glow: var(--primary-glow, rgba(255, 42, 116, 0.5));
    --secondary: var(--secondary-color, #8a2be2);
    --secondary-glow: var(--secondary-glow, rgba(138, 43, 226, 0.5));
    --accent: var(--accent-color, #ffd700);
    --accent-glow: var(--accent-glow, rgba(255, 215, 0, 0.5));
    --text-main: var(--text-color, #ffffff);
    --text-muted: #b0aebf;
    --glass-bg: var(--panel-bg, rgba(255, 255, 255, 0.06));
    --glass-border: var(--border-color, rgba(255, 255, 255, 0.1));
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* 移除 iOS 点击阴影 */
    user-select: none;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    /* 动态霓虹背景：渐变色缓慢流淌，跟随主题变换 */
    background: linear-gradient(125deg, var(--bg-dark), var(--bg-darker), var(--bg-dark), var(--bg-darker));
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-main);
    overflow: hidden; /* 防止橡皮筋拉伸 */
    width: 100vw;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 巨型背景霓虹发光球：缓慢浮动，带来极致的立体空间感 */
body::before, body::after {
    content: '';
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.15;
    filter: blur(90px);
}
body::before {
    background: var(--primary);
    top: 10%;
    left: 5%;
    animation: floatOrb1 15s ease-in-out infinite alternate;
}
body::after {
    background: var(--secondary);
    bottom: 10%;
    right: 5%;
    animation: floatOrb2 20s ease-in-out infinite alternate;
}

@keyframes floatOrb1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.3); }
}
@keyframes floatOrb2 {
    0% { transform: translate(0, 0) scale(1.3); }
    100% { transform: translate(-50px, -60px) scale(0.9); }
}

#app {
    width: 100%;
    max-width: 500px;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

/* ==========================================
   密码验证拦截层 (3D 炫彩改版)
   ========================================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 4, 10, 0.88);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    perspective: 1000px; /* 支持3D视角折叠淡出 */
}

.overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* 验证成功后，卡片以 3D 浮动、模糊渐隐的方式消失 */
.overlay.verified-fadeout {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1) rotateY(15deg) translateZ(100px);
    filter: blur(12px);
}

.guide-box {
    width: 85%;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 36px 28px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6),
                inset 0 1px 1px rgba(255, 255, 255, 0.1);
    transform: translateY(30px);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.overlay.active .guide-box {
    transform: translateY(0);
}

.guide-icon {
    font-size: 56px;
    margin-bottom: 20px;
    filter: drop-shadow(0 0 15px var(--primary-glow));
    animation: bounceIcon 2s infinite ease-in-out;
}

@keyframes bounceIcon {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.1); }
}

.guide-box h2 {
    font-family: 'ZCOOL KuaiLe', sans-serif;
    font-size: 28px;
    margin-bottom: 8px;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #ffffff 0%, var(--primary) 50%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(255, 42, 116, 0.2);
}

.guide-box p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* 密码输入框 */
.pass-input-wrapper {
    width: 100%;
    margin-bottom: 16px;
}

#pass-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: var(--text-main);
    padding: 14px;
    font-size: 18px;
    text-align: center;
    outline: none;
    letter-spacing: 6px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

#pass-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(255, 42, 116, 0.3),
                inset 0 2px 4px rgba(0,0,0,0.5);
}

.error-msg {
    color: #ff4a7d;
    font-size: 12px;
    margin-top: 8px;
    text-align: center;
    font-weight: 600;
    text-shadow: 0 0 8px rgba(255, 74, 125, 0.2);
}

/* 输入错误抖动动画 */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-10px); }
    30%, 60%, 90% { transform: translateX(10px); }
}

.shake-anim {
    animation: shake 0.45s cubic-bezier(.36,.07,.19,.97) both;
}

/* ==========================================
   顶部导航栏
   ========================================== */
.app-header {
    height: 65px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 10;
}

.title-font {
    font-family: 'ZCOOL KuaiLe', sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, var(--accent) 0%, #ff2a74 50%, #8a2be2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(255, 42, 116, 0.3));
}

.icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.icon-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ==========================================
   主游戏区 (滚动结果和转盘)
   ========================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 10px 20px 20px 20px;
    width: 100%;
}

/* 结果滚动展示区 (流光边框升级版) */
.result-display-wrapper {
    width: 100%;
    height: 140px; /* 固定高度防止跳动 */
    background: rgba(12, 9, 28, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 18px;
    position: relative;
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4),
                inset 0 1px 0px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

/* 顶部流光光条动画 */
.result-display-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--accent), var(--secondary), transparent);
    background-size: 200% auto;
    animation: shineLine 4s linear infinite;
}

@keyframes shineLine {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.result-tip {
    position: absolute;
    top: 18px;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 600;
}

.result-text {
    font-size: 22px;
    font-weight: 900;
    text-align: center;
    line-height: 1.4;
    padding: 0 12px;
    color: #ffffff;
    /* 霓虹发光字效 */
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8),
                 0 0 20px var(--primary),
                 0 0 35px var(--secondary);
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* 限制行数并隐藏溢出，防止撑开容器 */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
    margin-top: 16px; /* 为绝对定位的 title 腾出空间 */
}

.result-text.blinking {
    animation: flash 0.8s infinite alternate;
}

.result-text.spinning-active {
    color: #fff;
    text-shadow: 0 0 8px rgba(255,255,255,0.6), 0 0 15px rgba(255, 255, 255, 0.3);
    transform: scale(0.92);
}

/* 转盘区域 */
.wheel-outer-wrapper {
    position: relative;
    width: 88vw;
    height: 88vw;
    max-width: 370px;
    max-height: 370px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.wheel-canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 0 35px var(--primary-glow),
                0 0 70px var(--primary-glow),
                inset 0 0 20px rgba(255,255,255,0.05);
}

/* 霓虹流光外框环：渐变边框，且自动顺时针慢慢旋转 */
.wheel-canvas-container::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    opacity: 0.75;
    pointer-events: none;
    animation: outerRingRotate 25s linear infinite;
}

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

#wheel-canvas {
    width: 100%;
    height: 100%;
    display: block;
    transform: rotate(-90deg);
}

/* 顶部物理指针 */
.pointer-wrapper {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
}

.pointer {
    width: 24px;
    height: 32px;
    background: #ffffff;
    clip-path: polygon(50% 100%, 0 0, 100% 0);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.5));
    transform-origin: 50% 10%;
}

.pointer.bounce-tick {
    animation: pointer-tick 0.12s ease-out;
}

/* 转盘中心启动按钮 (赛博磨砂玻璃霓虹发光重塑) */
#spin-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(10, 8, 22, 0.85); /* 赛博深黑半透明 */
    border: 3.5px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55),
                0 0 20px var(--primary-glow),
                inset 0 0 12px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#spin-btn::after {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    animation: rotate-dashed 15s linear infinite;
}

#spin-btn:active {
    transform: translate(-50%, -50%) scale(0.92);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4),
                0 0 25px var(--primary),
                inset 0 0 10px rgba(255, 42, 116, 0.4);
}

.spin-text {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 0.5px;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.8),
                 0 0 12px var(--primary);
}

/* ==========================================
   滑动抽屉 (磨砂玻璃与赛博暗黑结合)
   ========================================== */
.drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    visibility: hidden;
    transition: visibility 0.4s;
}

.drawer.open {
    visibility: visible;
}

.drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 4, 10, 0.8);
    opacity: 0;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer.open .drawer-overlay {
    opacity: 1;
}

.drawer-content {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 100%);
    width: 100%;
    max-width: 500px;
    background: rgba(14, 10, 31, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 32px 32px 0 0;
    padding: 18px 22px calc(22px + var(--safe-bottom)) 22px;
    box-shadow: 0 -15px 45px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255,255,255,0.05);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    max-height: 80dvh;
}

.drawer.open .drawer-content {
    transform: translate(-50%, 0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.drawer-handle {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 4px;
    background: var(--glass-border);
    border-radius: 2px;
}

.drawer-header h3 {
    font-size: 19px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    -webkit-overflow-scrolling: touch;
}

/* 选项卡 (Tabs) */
.tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 18px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 12px 0;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.tab-btn.active {
    background: var(--glass-bg);
    color: var(--text-main);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255,255,255,0.05);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

/* ==========================================
   配置面板子组件特定样式
   ========================================== */

/* 规则编辑 */
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: var(--text-main);
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    outline: none;
    margin-bottom: 18px;
    transition: all 0.2s ease;
}

textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 42, 116, 0.2);
}

.rules-actions {
    display: flex;
    gap: 12px;
}

/* 预设列表 */
.presets-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-preset {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    padding: 22px 12px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.btn-preset:active {
    background: var(--glass-bg);
    transform: translateY(2px);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(255, 42, 116, 0.2);
}

/* 分享面板 */
.share-result {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.4s ease forwards;
}

.share-result.hide {
    display: none;
}

.qr-container {
    background: white;
    padding: 18px;
    border-radius: 22px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.qr-tip {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.copy-url-wrapper {
    display: flex;
    width: 100%;
    gap: 8px;
}

.copy-url-wrapper input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: var(--text-muted);
    padding: 0 14px;
    font-size: 12px;
    outline: none;
}

/* Toast 提示 */
.toast {
    position: fixed;
    bottom: 40%;
    left: 50%;
    transform: translate(-50%, 0);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    z-index: 2000;
    box-shadow: 0 15px 30px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
}

.toast.hide {
    display: none;
}

/* 通用按钮系统 */
.btn {
    border: none;
    border-radius: 14px;
    padding: 14px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.btn-primary:active {
    transform: scale(0.97);
    filter: brightness(0.9);
}

.btn-glow {
    box-shadow: 0 4px 20px rgba(255, 42, 116, 0.45);
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(255, 42, 116, 0.12);
    border: 1px solid rgba(255, 42, 116, 0.25);
    color: #ff527c;
}

.btn-danger:active {
    background: rgba(255, 42, 116, 0.22);
}

.btn-block {
    display: flex;
    width: 100%;
}

.hide {
    display: none !important;
}

/* ==========================================
   动画定义
   ========================================== */
@keyframes wave {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(10deg); }
}

@keyframes flash {
    from { opacity: 0.8; text-shadow: 0 0 10px rgba(255,255,255,0.7), 0 0 20px var(--primary); }
    to { opacity: 1; text-shadow: 0 0 25px rgba(255,255,255,0.9), 0 0 35px var(--primary), 0 0 50px var(--secondary); }
}

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

@keyframes pointer-tick {
    0% { transform: rotate(0deg); }
    30% { transform: rotate(-16deg); }
    100% { transform: rotate(0deg); }
}

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

/* ==========================================
   单视图容器
   ========================================== */
.game-views-wrapper {
    flex: 1;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 10px 20px 20px 20px;
}

#view-wheel {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}
