/* 粉色主题样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    /* Telegram浏览器适配 */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 登录页面 */
.login-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(255, 105, 180, 0.3);
    max-width: 400px;
    margin: 100px auto;
    backdrop-filter: blur(10px);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: #ff69b4;
    font-size: 32px;
    margin-bottom: 10px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ffb6c1;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    background: #fff;
}

.login-form input:focus {
    outline: none;
    border-color: #ff69b4;
    box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 105, 180, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.loading-msg {
    color: #666;
    font-size: 14px;
    margin-top: 20px;
}

.loading-msg div {
    margin-bottom: 10px;
}

.error-msg {
    color: #ff4757;
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
    min-height: 20px;
}

/* 头部栏 */
.header-bar {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.2);
    backdrop-filter: blur(10px);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.username {
    color: #ff69b4;
    font-weight: 600;
    font-size: 16px;
}

.points {
    color: #333;
    font-size: 16px;
}

.points strong {
    color: #ff69b4;
    font-size: 18px;
}

.logout-btn {
    margin-left: auto;
    padding: 8px 20px;
    background: #ff4757;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #ff3838;
    transform: translateY(-2px);
}

/* 抽奖容器 */
.lottery-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(255, 105, 180, 0.3);
    backdrop-filter: blur(10px);
}

.section-title {
    color: #ff69b4;
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

/* 活动列表 */
.activities-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    min-height: 100px; /* 确保有最小高度 */
    visibility: visible !important; /* 确保可见 */
    opacity: 1 !important; /* 确保不透明 */
}

.activity-card {
    background: linear-gradient(135deg, #ffeef7 0%, #fff0f5 100%);
    border: 2px solid #ffb6c1;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.activity-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 105, 180, 0.4);
    border-color: #ff69b4;
}

.activity-card.active {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    color: white;
    border-color: #ff1493;
}

.activity-card h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.activity-card .cost {
    font-size: 18px;
    font-weight: 600;
    color: #ff69b4;
}

.activity-card.active .cost {
    color: white;
}

/* 抽奖盒子 */
.lottery-box {
    margin: 30px 0;
    padding: 30px;
    background: linear-gradient(135deg, #fff0f5 0%, #ffeef7 100%);
    border-radius: 15px;
    border: 2px solid #ffb6c1;
}

.activity-name {
    text-align: center;
    color: #ff69b4;
    font-size: 22px;
    margin-bottom: 20px;
}

.prizes-probability {
    margin-bottom: 30px;
}

.prizes-probability h4 {
    color: #ff69b4;
    margin-bottom: 15px;
    font-size: 18px;
}

.probability-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.probability-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #ffb6c1;
    text-align: center;
}

.probability-item .prize-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.probability-item .prize-prob {
    color: #ff69b4;
    font-size: 14px;
}

/* 抽奖转盘 */
.lottery-wheel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 30px 0;
}

/* 外层容器，控制整体大小，参考设计稿 360x360，PC 端稍大，移动端由媒体查询控制 */
.wheel-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 40px; /* 给底部按钮留一点空间 */
}

.wheel-container {
    position: relative;
    /* 宽度根据视口自适应，高度通过 aspect-ratio 保证为正方形，避免在手机上拉伸成椭圆 */
    width: min(400px, 90vw, 90vh);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(255, 105, 180, 0.5);
    position: relative;
    overflow: visible;
    transition: none;
    background: transparent;
}

#wheelCanvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50%;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
    z-index: 1;
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    border-radius: 50%;
    border: 4px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
    pointer-events: none;
}

/* 指针样式 */
.wheel-pointer {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 35px solid #ff4757;
    z-index: 20;
    pointer-events: none;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
    transition: none;
}

.wheel-pointer::before {
    content: '';
    position: absolute;
    top: -35px;
    left: -9px;
    width: 18px;
    height: 18px;
    background: #ff4757;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.wheel.spinning {
    transition: none; /* 使用JavaScript控制动画，不使用CSS transition */
}

.btn-lottery {
    width: 240px;
    height: 60px;
    background: linear-gradient(90deg, #ff66b2, #ff3385); /* 亮粉色渐变 */
    border-radius: 30px;
    border: none;
    color: white;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 51, 133, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
    outline: none;
    letter-spacing: 2px;
    display: block;
    margin: 0 auto;
}

.btn-lottery:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(255, 51, 133, 0.6);
}

.btn-lottery:active:not(:disabled) {
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(255, 51, 133, 0.4);
}

.btn-lottery:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    letter-spacing: 2px;
}

/* 抽奖记录 */
.records-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #ffb6c1;
}

.records-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.record-item {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    border-left: 4px solid #ff69b4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.record-item:hover {
    box-shadow: 0 4px 10px rgba(255, 105, 180, 0.2);
    transform: translateX(5px);
}

.record-item .record-info {
    flex: 1;
}

.record-item .record-prize {
    font-weight: 600;
    color: #ff69b4;
    font-size: 16px;
}

.record-item .record-time {
    color: #999;
    font-size: 12px;
    margin-top: 5px;
}

.record-item .record-cost {
    color: #666;
    font-size: 14px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    overflow: auto;
}

.modal-content {
    background: white;
    margin: 10% auto;
    padding: 40px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 40px rgba(255, 105, 180, 0.5);
    animation: modalShow 0.3s;
    z-index: 10001;
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #ff69b4;
}

.result-content {
    text-align: center;
}

.result-content h2 {
    color: #ff69b4;
    font-size: 28px;
    margin-bottom: 20px;
}

.result-content .prize-result {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.result-content .card-code {
    background: #fff0f5;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #ff69b4;
    word-break: break-all;
}

/* 后台管理样式 */
.admin-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(255, 105, 180, 0.3);
    margin-bottom: 20px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #ffb6c1;
}

.admin-nav {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 10px 20px;
    background: #fff0f5;
    color: #ff69b4;
    border: 2px solid #ffb6c1;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.nav-btn:hover,
.nav-btn.active {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    color: white;
    border-color: #ff1493;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ffb6c1;
}

.admin-table th {
    background: #fff0f5;
    color: #ff69b4;
    font-weight: 600;
}

.admin-table tr:hover {
    background: #fff0f5;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    align-items: start; /* 确保顶部对齐 */
}

.form-group-admin {
    margin-bottom: 0; /* 移除底部边距，由form-row的gap控制 */
    display: flex;
    flex-direction: column;
}

.form-group-admin label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    min-height: 20px; /* 确保label高度一致 */
    line-height: 1.4;
}

.form-group-admin input,
.form-group-admin select,
.form-group-admin textarea {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #ffb6c1;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    box-sizing: border-box; /* 确保padding不会影响宽度 */
    min-height: 42px; /* 确保所有输入框高度一致 */
}

.form-group-admin input:focus,
.form-group-admin select:focus,
.form-group-admin textarea:focus {
    outline: none;
    border-color: #ff69b4;
    box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.1);
}

.btn-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(46, 204, 113, 0.4);
}

.btn-danger {
    background: #ff4757;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.btn-danger:hover {
    background: #ff3838;
}

.btn-edit {
    background: #ffa502;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
    transition: all 0.3s;
}

.btn-edit:hover {
    background: #ff9500;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .login-box {
        margin: 50px auto;
        padding: 30px 20px;
    }

    .lottery-container {
        padding: 20px;
    }

    .activities-list {
        grid-template-columns: 1fr;
    }


    .user-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .logout-btn {
        margin-left: 0;
    }

    .wheel-wrapper {
        width: 100%;
        margin-bottom: 30px;
    }
    
    .wheel-container {
        /* 手机端也保持完美正方形，优先用视口宽度 */
        width: min(320px, 85vw);
        aspect-ratio: 1 / 1;
        max-width: 85vw;
    }
    
    .wheel-pointer {
        top: -20px;
        border-left-width: 16px;
        border-right-width: 16px;
        border-top-width: 32px;
    }
    
    .wheel-pointer::before {
        top: -32px;
        left: -8px;
        width: 16px;
        height: 16px;
    }

    .wheel-center {
        width: 50px;
        height: 50px;
    }
    
    .lottery-wheel {
        margin: 20px 0;
    }

    .btn-lottery {
        padding: 14px 40px;
        font-size: 16px;
        min-width: 180px;
    }
}

