/* =============================================
   복불복 스타일
   ============================================= */

html { background: #000; }

.rd-body {
    overflow: hidden;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #f0f0f0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.rd-game {
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #0f0f1a;
}

/* Top Bar */
.rd-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
    flex-shrink: 0;
}
.rd-back {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}
.rd-back:hover { color: #fff; }
.rd-info-badge {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
}

/* Content */
.rd-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}

/* ===== Setup Screen ===== */
.rd-setup-title {
    font-size: 48px;
    margin-bottom: 8px;
}
.rd-setup-name {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}
.rd-setup-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 24px;
    text-align: center;
    line-height: 1.5;
}

/* Player input */
.rd-input-row {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 320px;
    margin-bottom: 16px;
}
.rd-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid #2d2d44;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    outline: none;
}
.rd-input:focus {
    border-color: #6C5CE7;
    background: rgba(108, 92, 231, 0.1);
}
.rd-input::placeholder { color: rgba(255, 255, 255, 0.3); }

.rd-btn-add {
    padding: 12px 20px;
    background: #6C5CE7;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.1s;
}
.rd-btn-add:active { transform: scale(0.95); }

.rd-player-list {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    max-height: 160px;
    overflow-y: auto;
}
.rd-player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    border: 1px solid #2d2d44;
}
.rd-player-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}
.rd-player-num {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-right: auto;
    margin-left: 10px;
}
.rd-btn-remove {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
}
.rd-btn-remove:hover { color: #ff6b6b; }

.rd-player-count {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 8px;
}

/* Penalty settings */
.rd-settings {
    width: 100%;
    max-width: 320px;
    margin-bottom: 20px;
}
.rd-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.rd-setting-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}
.rd-setting-control {
    display: flex;
    align-items: center;
    gap: 12px;
}
.rd-btn-pm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #2d2d44;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.rd-btn-pm:active { background: rgba(108, 92, 231, 0.3); }
.rd-setting-val {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    min-width: 24px;
    text-align: center;
}

.rd-penalty-input {
    width: 100%;
    max-width: 320px;
    margin-bottom: 20px;
}
.rd-penalty-input input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid #2d2d44;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
}
.rd-penalty-input input:focus {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.08);
}
.rd-penalty-input input::placeholder { color: rgba(255, 255, 255, 0.3); }

.rd-btn-start {
    padding: 16px 48px;
    background: linear-gradient(135deg, #6C5CE7, #a855f7);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.rd-btn-start:active { transform: scale(0.95); }
.rd-btn-start:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Shuffle Animation ===== */
.rd-shuffle-msg {
    font-size: 20px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 24px;
    text-align: center;
}

/* ===== Cup Grid ===== */
.rd-cup-grid {
    display: grid;
    gap: 12px;
    width: 100%;
    max-width: 380px;
    justify-items: center;
}
.rd-cup-grid.rd-cols-2 { grid-template-columns: repeat(2, 1fr); }
.rd-cup-grid.rd-cols-3 { grid-template-columns: repeat(3, 1fr); }
.rd-cup-grid.rd-cols-4 { grid-template-columns: repeat(4, 1fr); }
.rd-cup-grid.rd-cols-5 { grid-template-columns: repeat(5, 1fr); }

.rd-cup {
    width: 100%;
    max-width: 90px;
    aspect-ratio: 1;
    border-radius: 16px;
    border: 2px solid #2d2d44;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}
.rd-cup:active { transform: scale(0.95); }

.rd-cup-emoji {
    font-size: 36px;
    transition: transform 0.3s;
}
.rd-cup-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* Shuffle animation */
.rd-cup.rd-shuffling {
    animation: rd-shake 0.3s ease-in-out;
}
@keyframes rd-shake {
    0% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-8px) rotate(-5deg); }
    50% { transform: translateX(8px) rotate(5deg); }
    75% { transform: translateX(-4px) rotate(-3deg); }
    100% { transform: translateX(0) rotate(0deg); }
}

/* Opened states */
.rd-cup.rd-opened {
    pointer-events: none;
    cursor: default;
}
.rd-cup.rd-safe {
    border-color: rgba(0, 255, 136, 0.4);
    background: rgba(0, 255, 136, 0.08);
}
.rd-cup.rd-penalty {
    border-color: rgba(255, 107, 107, 0.6);
    background: rgba(255, 107, 107, 0.12);
    animation: rd-penalty-pulse 0.5s ease-out;
}
@keyframes rd-penalty-pulse {
    0% { transform: scale(1.15); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.rd-cup-result {
    font-size: 32px;
}

/* ===== Result (kept for extra content) ===== */
.rd-result-losers {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}
.rd-loser-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 12px;
}
.rd-loser-emoji { font-size: 28px; }
.rd-loser-name {
    font-size: 18px;
    font-weight: 700;
    color: #ff6b6b;
}
.rd-loser-penalty {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    margin-left: auto;
}

.rd-safe-list {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
}
.rd-safe-tag {
    padding: 8px 16px;
    background: rgba(0, 255, 136, 0.08);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 20px;
    font-size: 14px;
    color: #00ff88;
    font-weight: 600;
}

/* Toast */
.rd-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    white-space: nowrap;
}
.rd-toast-show {
    opacity: 1;
    pointer-events: auto;
}
