/* =============================================
   업다운 게임 스타일 (ud- prefix)
   ============================================= */

html { background: #000; }

.ud-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;
}

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

/* Top Bar */
.ud-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
    flex-shrink: 0;
}
.ud-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);
}
.ud-back:hover { color: #fff; }
.ud-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 */
.ud-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    overflow-y: auto;
}

/* ===== Setup Screen ===== */
.ud-setup-wrap {
    width: 100%;
    max-width: 360px;
    text-align: center;
}
.ud-setup-emoji { font-size: 64px; margin-bottom: 12px; }
.ud-setup-title {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
}
.ud-setup-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Name input */
.ud-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.ud-name-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #2d2d44;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}
.ud-name-input:focus { border-color: #10b981; }
.ud-name-input::placeholder { color: rgba(255, 255, 255, 0.3); }

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

/* Player list */
.ud-player-list {
    width: 100%;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.ud-player-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 14px;
    color: #fff;
}
.ud-player-remove {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.ud-player-count {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 16px;
}

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

/* ===== Playing Screen ===== */
.ud-play-wrap {
    width: 100%;
    max-width: 360px;
    text-align: center;
}
.ud-turn-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 4px;
}
.ud-turn-name {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
}

/* Range display */
.ud-range-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
}
.ud-range-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #06b6d4);
    border-radius: 4px;
    transition: all 0.4s ease;
    position: absolute;
}
.ud-range-text {
    display: flex;
    justify-content: space-between;
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    margin-bottom: 20px;
}
.ud-range-low { color: #10b981; }
.ud-range-high { color: #06b6d4; }
.ud-range-sep { color: rgba(255, 255, 255, 0.3); font-size: 20px; align-self: center; }

/* Guess input */
.ud-guess-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    justify-content: center;
}
.ud-guess-input {
    width: 120px;
    padding: 14px 16px;
    border: 2px solid #2d2d44;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    -moz-appearance: textfield;
}
.ud-guess-input::-webkit-outer-spin-button,
.ud-guess-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.ud-guess-input:focus { border-color: #10b981; }

.ud-btn-guess {
    padding: 14px 28px;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.ud-btn-guess:active { transform: scale(0.95); }

/* Hint display */
.ud-hint {
    font-size: 48px;
    font-weight: 900;
    margin-bottom: 16px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: ud-hint-pop 0.3s ease-out;
}
@keyframes ud-hint-pop {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
.ud-hint-up { color: #ef4444; }
.ud-hint-down { color: #3b82f6; }

/* History */
.ud-history {
    width: 100%;
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}
.ud-history-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    font-size: 13px;
}
.ud-history-name {
    font-weight: 600;
    color: #fff;
    min-width: 60px;
}
.ud-history-guess {
    font-weight: 800;
    color: #10b981;
    min-width: 32px;
    text-align: center;
}
.ud-history-hint {
    color: rgba(255, 255, 255, 0.5);
    flex: 1;
    text-align: right;
}

/* ===== Result Screen (kept for extra content) ===== */
.ud-result-answer {
    font-size: 18px;
    color: #ffd700;
    font-weight: 700;
    margin-bottom: 20px;
}

/* Full history in result */
.ud-result-history {
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 24px;
}

/* Toast */
.ud-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;
}
.ud-toast-show { opacity: 1; pointer-events: auto; }
