/* 随机点名转盘 - 黑板教室风 */

* { box-sizing: border-box; }

.rp-fullscreen {
    position: fixed; inset: 0; overflow: hidden;
    background: radial-gradient(ellipse at center, #2d4a3a 0%, #1a3225 100%);
    color: #fff;
    font-family: 'STKaiti','华文楷体','楷体','KaiTi','Kalam','Caveat', sans-serif;
    display: flex; flex-direction: column;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* 黑板纹理：粉笔粉点叠加 */
.rp-fullscreen::before {
    content: '';
    position: absolute; inset: 0;
    background-image:
        radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        radial-gradient(rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 14px 14px, 28px 28px;
    background-position: 0 0, 7px 7px;
    pointer-events: none;
}

.hidden { display: none !important; }

/* ========== 顶栏 ========== */
.rp-header {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px;
    background: rgba(0,0,0,0.18);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: relative; z-index: 10;
}
.rp-back {
    display: flex; align-items: center; gap: 6px;
    color: #d6e3d8; text-decoration: none;
    font-size: 16px; font-family: -apple-system, system-ui, sans-serif;
    padding: 6px 10px; border-radius: 8px;
    transition: background 0.15s;
}
.rp-back:hover { background: rgba(255,255,255,0.08); }
.rp-back i { font-size: 18px; }

.rp-class-switcher {
    flex: 1; position: relative;
    display: flex; justify-content: center;
}
.rp-class-btn {
    background: rgba(255,255,255,0.1);
    color: #fff; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 18px; font-family: 'Kalam','楷体', cursive;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    min-width: 180px; justify-content: center;
    transition: background 0.15s;
}
.rp-class-btn:hover { background: rgba(255,255,255,0.18); }
.rp-class-btn i { font-size: 14px; opacity: 0.7; }

.rp-class-menu {
    position: absolute; top: calc(100% + 8px); left: 50%;
    transform: translateX(-50%);
    background: #2d4a3a; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px; min-width: 240px; max-width: 92vw;
    padding: 8px; z-index: 20;
    box-shadow: 0 12px 36px rgba(0,0,0,0.5);
    max-height: 60vh; overflow-y: auto;
    font-family: -apple-system, system-ui, sans-serif;
}
.rp-class-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 10px 12px;
    border-radius: 8px; cursor: pointer;
    color: #e6f0e8; font-size: 15px;
}
.rp-class-item:hover { background: rgba(255,255,255,0.08); }
.rp-class-item.active { background: rgba(255,255,255,0.14); }
.rp-class-item .meta { font-size: 12px; opacity: 0.6; }
.rp-class-item-add {
    border-top: 1px dashed rgba(255,255,255,0.15);
    margin-top: 6px; padding-top: 12px;
    color: #ffd97d;
}
.rp-class-item-add:hover { background: rgba(255,217,125,0.1); }

.rp-header-actions { display: flex; gap: 6px; }
.rp-icon-btn {
    background: transparent; border: none; color: #d6e3d8;
    width: 38px; height: 38px; border-radius: 8px;
    cursor: pointer; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.rp-icon-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* ========== 主体 ========== */
.rp-main {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column; align-items: center;
    padding: 16px; gap: 14px;
    position: relative; z-index: 1;
}

.rp-stage {
    flex: 1; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    width: 100%;
    position: relative;
}

/* 转盘 */
.rp-wheel-wrap {
    position: relative;
    width: min(56vh, 92vw, 520px);
    height: min(56vh, 92vw, 520px);
}
.rp-wheel {
    width: 100%; height: 100%;
    transform: rotate(0deg);
    transition: transform 4.2s cubic-bezier(.17,.67,.4,1);
    filter: drop-shadow(0 6px 24px rgba(0,0,0,0.4));
}
.rp-wheel.spinning { /* 用 JS 设 transform */ }

.rp-pointer {
    position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
    color: #ffd97d; font-size: 36px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: 3; pointer-events: none;
}

.rp-wheel-slice-text {
    font-family: 'STKaiti','华文楷体','楷体','KaiTi', cursive;
    font-weight: 600;
    fill: #fff;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.rp-wheel-empty {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 14px; color: #c9d8cb;
    font-family: -apple-system, system-ui, sans-serif;
    font-size: 18px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    border: 2px dashed rgba(255,255,255,0.18);
}
.rp-wheel-empty i { font-size: 64px; opacity: 0.5; }

/* 中奖名字（全屏视为主角） */
.rp-winner {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 5;
    animation: rpWinnerPop 0.4s cubic-bezier(.34,1.56,.64,1);
}
.rp-winner-label {
    font-size: 18px; color: #ffd97d; opacity: 0.9;
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.rp-winner-name {
    font-size: clamp(48px, 12vw, 140px);
    font-weight: 700;
    color: #fff;
    text-shadow:
        0 0 20px rgba(255,217,125,0.6),
        0 4px 24px rgba(0,0,0,0.7);
    letter-spacing: 0.05em;
    font-family: 'STKaiti','华文楷体','楷体','KaiTi', cursive;
}
@keyframes rpWinnerPop {
    0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
    60% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ========== 控制区 ========== */
.rp-controls {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 18px;
    flex-wrap: wrap; justify-content: center;
    font-family: -apple-system, system-ui, sans-serif;
}
.rp-spin-btn {
    background: linear-gradient(135deg, #ffd97d 0%, #ffb347 100%);
    color: #2d2010; border: none;
    padding: 14px 36px; border-radius: 999px;
    font-size: 20px; font-weight: 700;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 6px 18px rgba(255,180,71,0.4);
    transition: transform 0.1s, box-shadow 0.15s;
}
.rp-spin-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 9px 24px rgba(255,180,71,0.55);
}
.rp-spin-btn:active:not(:disabled) { transform: translateY(0); }
.rp-spin-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.rp-spin-btn i { font-size: 22px; }

.rp-toggle {
    display: flex; align-items: center; gap: 8px;
    color: #d6e3d8; font-size: 15px; cursor: pointer;
}
.rp-toggle input { accent-color: #ffd97d; width: 18px; height: 18px; }

.rp-text-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.2);
    color: #d6e3d8; padding: 8px 14px; border-radius: 8px;
    font-size: 14px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px;
    font-family: inherit;
    transition: all 0.15s;
}
.rp-text-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.rp-text-btn.small { padding: 4px 10px; font-size: 13px; }
.rp-text-btn.danger { color: #ff8a80; border-color: rgba(255,138,128,0.3); }
.rp-text-btn.danger:hover { background: rgba(255,138,128,0.12); color: #ff8a80; }

/* ========== 历史 ========== */
.rp-history {
    flex: 0 0 auto;
    width: min(800px, 100%);
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 10px 14px;
    font-family: -apple-system, system-ui, sans-serif;
    max-height: 22vh; min-height: 60px;
    display: flex; flex-direction: column; gap: 6px;
}
.rp-history-head {
    display: flex; justify-content: space-between; align-items: center;
    color: #c9d8cb; font-size: 14px;
}
.rp-history-list {
    flex: 1; min-height: 0; overflow-y: auto;
    display: flex; flex-wrap: wrap; gap: 6px;
}
.rp-history-item {
    background: rgba(255,217,125,0.15);
    color: #ffe9b8;
    padding: 4px 12px; border-radius: 999px;
    font-size: 14px;
    border: 1px solid rgba(255,217,125,0.25);
}

/* ========== 名单弹窗 ========== */
.rp-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    padding: 20px;
    font-family: -apple-system, system-ui, sans-serif;
    animation: rpFadeIn 0.15s ease-out;
}
@keyframes rpFadeIn { from { opacity: 0; } to { opacity: 1; } }

.rp-modal-card {
    background: #fbf8ed;
    color: #2d2010;
    border-radius: 16px;
    width: min(560px, 100%);
    max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}
.rp-modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(45,32,16,0.1);
}
.rp-modal-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.rp-modal-head .rp-icon-btn { color: #6b5840; }
.rp-modal-head .rp-icon-btn:hover { background: rgba(45,32,16,0.06); color: #2d2010; }

.rp-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1; min-height: 0;
}
.rp-modal-row { margin-bottom: 14px; }
.rp-modal-row:last-child { margin-bottom: 0; }
.rp-label {
    display: block; margin-bottom: 6px;
    font-size: 14px; color: #6b5840; font-weight: 600;
}
.rp-input, .rp-textarea {
    width: 100%; padding: 10px 14px;
    border: 1px solid #d4c8a8;
    border-radius: 8px;
    background: #fff;
    color: #2d2010;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s;
}
.rp-input:focus, .rp-textarea:focus {
    outline: none; border-color: #ffb347;
    box-shadow: 0 0 0 3px rgba(255,179,71,0.15);
}
.rp-textarea { resize: vertical; min-height: 180px; line-height: 1.6; }

.rp-modal-hint {
    margin-top: 6px;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: #8b7456;
}
.rp-modal-hint #rpModalCount { font-weight: 700; color: #2d4a3a; }
.rp-modal-hint-tip { font-size: 12px; opacity: 0.8; }

.rp-modal-foot {
    padding: 14px 20px;
    border-top: 1px solid rgba(45,32,16,0.1);
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px;
    background: #f5f0dd;
}
.rp-modal-foot-right { display: flex; gap: 10px; }
.rp-btn-primary {
    background: #ffb347; color: #2d2010;
    border: none; padding: 10px 20px; border-radius: 8px;
    font-size: 15px; font-weight: 700; cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.rp-btn-primary:hover { background: #ffa027; }
.rp-btn-secondary {
    background: transparent; color: #6b5840;
    border: 1px solid #d4c8a8;
    padding: 10px 20px; border-radius: 8px;
    font-size: 15px; cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.rp-btn-secondary:hover { background: rgba(45,32,16,0.04); }

.rp-modal-foot .rp-text-btn.danger {
    color: #c0392b; border-color: rgba(192,57,43,0.3);
}
.rp-modal-foot .rp-text-btn.danger:hover { background: rgba(192,57,43,0.08); color: #c0392b; }

/* ========== 隐私提示 ========== */
.rp-privacy-tip {
    margin-top: 12px;
    background: #eef6ee;
    color: #2d4a3a;
    border: 1px solid #c9e0cd;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    display: flex; align-items: flex-start; gap: 8px;
    font-family: -apple-system, system-ui, sans-serif;
}
.rp-privacy-tip i { color: #4a8d5a; font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.rp-privacy-tip strong { color: #1f5a2d; }

.rp-privacy-foot {
    flex: 0 0 auto;
    color: rgba(255,255,255,0.4);
    font-size: 12px;
    font-family: -apple-system, system-ui, sans-serif;
    text-align: center;
    padding: 0 16px;
}
.rp-privacy-foot i { color: rgba(167,212,176,0.6); margin-right: 4px; }
.rp-fullscreen.is-fs .rp-privacy-foot { display: none; }

/* ========== Toast ========== */
.rp-toast {
    position: fixed; left: 50%; bottom: 60px;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85); color: #fff;
    padding: 10px 20px; border-radius: 999px;
    font-size: 14px; font-family: -apple-system, system-ui, sans-serif;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 200;
}
.rp-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

/* ========== 全屏模式（隐藏顶栏/历史/控制区，只留转盘和中奖名字） ========== */
.rp-fullscreen.is-fs .rp-header,
.rp-fullscreen.is-fs .rp-history { display: none; }
.rp-fullscreen.is-fs .rp-controls {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.4); padding: 10px 20px; border-radius: 999px;
    backdrop-filter: blur(8px);
    z-index: 8;
}
.rp-fullscreen.is-fs .rp-wheel-wrap {
    width: min(80vh, 90vw);
    height: min(80vh, 90vw);
}
.rp-fullscreen.is-fs::after {
    content: '按 Esc 退出全屏';
    position: fixed; top: 16px; right: 20px;
    font-size: 12px; color: rgba(255,255,255,0.5);
    font-family: -apple-system, system-ui, sans-serif;
    pointer-events: none;
}

/* ========== 移动端适配 ========== */
@media (max-width: 600px) {
    .rp-header { padding: 8px 12px; gap: 8px; }
    .rp-class-btn { font-size: 16px; min-width: 140px; padding: 6px 12px; }
    .rp-back span { display: none; }
    .rp-main { padding: 10px; gap: 10px; }
    .rp-wheel-wrap {
        width: min(50vh, 88vw);
        height: min(50vh, 88vw);
    }
    .rp-spin-btn { padding: 12px 28px; font-size: 18px; }
    .rp-history { max-height: 18vh; }
}
