/* ========================================================
   TTEUM 사다리 타기 (Ladder Game) 전용 스타일시트
   - 좌우 2분할 대시보드 레이아웃 (좌: 사다리 | 우: 입력 패널)
   - 네오둥근모(NeoDonggeunmo) 레트로 아케이드 폰트 전역 적용
   ======================================================== */

@font-face {
    font-family: 'NeoDonggeunmo';
    src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.3/NeoDunggeunmo.woff') format('woff');
    font-weight: normal;
    font-display: swap;
}

html, body, .ladder-body {
    background-color: #070a12 !important;
    color: #ffffff !important;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-family: 'NeoDonggeunmo', 'Outfit', 'Noto Sans KR', sans-serif !important;
}

* {
    font-family: 'NeoDonggeunmo', 'Outfit', 'Noto Sans KR', sans-serif !important;
}

.ladder-app {
    max-width: 1440px;
    margin: 0 auto;
    padding: 12px 18px 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.badge-ladder {
    background: linear-gradient(135deg, #00f5d4 0%, #4cc9f0 100%);
    color: #080c16;
    font-size: 11px;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* 📐 좌우 2분할 대시보드 레이아웃 */
.ladder-main-layout {
    display: grid;
    grid-template-columns: minmax(480px, 1fr) 390px;
    gap: 16px;
    align-items: start;
}

.ladder-col-game {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.ladder-col-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

/* 우측 설정 카드 (컴팩트 핏) */
.setup-card {
    background: #0e1526;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.setup-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.header-label-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.setup-icon {
    font-size: 16px;
}

.setup-title {
    font-size: 14px;
    font-weight: 800;
    color: #ffffff;
}

.badge-count {
    background: #1e293b;
    color: #00f5d4;
    border: 1px solid #00f5d4;
    font-size: 10.5px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
}

.setup-desc {
    font-size: 11px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.35;
}

.quick-sample-actions, .quick-preset-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.btn-preset-small, .btn-preset-pill {
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-preset-small:hover, .btn-preset-pill:hover {
    background: #334155;
    color: #00f5d4;
    border-color: #00f5d4;
}

.input-action-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ladder-text-input {
    flex: 1;
    background: #070a12;
    border: 1px solid #334155;
    color: #ffffff;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 12px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.ladder-text-input:focus {
    outline: none;
    border-color: #00f5d4;
    box-shadow: 0 0 8px rgba(0, 245, 212, 0.4);
}

.btn-setup-action {
    background: #1e293b;
    border: 1px solid #00f5d4;
    color: #00f5d4;
    font-size: 11.5px;
    font-weight: 800;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-setup-action:hover {
    background: #00f5d4;
    color: #080c16;
    box-shadow: 0 0 10px rgba(0, 245, 212, 0.5);
}

/* 태그 풀 */
.participant-tags-pool, .outcome-tags-pool {
    background: #070a12;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 8px 10px;
    min-height: 48px;
    max-height: 100px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.pool-empty-msg {
    color: #64748b;
    font-size: 11px;
}

.participant-tag, .outcome-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 5px;
    padding: 3px 6px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    transition: all 0.15s ease;
}

.participant-tag:hover {
    border-color: #4cc9f0;
    box-shadow: 0 0 8px rgba(76, 201, 240, 0.3);
}

.tag-del-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 10px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.tag-del-btn:hover {
    color: #f72585;
}

.tag-outcome-win {
    border-color: #fee440;
    color: #fee440;
    background: rgba(254, 228, 64, 0.12);
}

.tag-outcome-lose {
    border-color: #f72585;
    color: #f72585;
    background: rgba(247, 37, 133, 0.12);
}

.tag-outcome-other {
    border-color: #00f5d4;
    color: #00f5d4;
    background: rgba(0, 245, 212, 0.12);
}

/* 🕹️ 좌측: 컨트롤 바 */
.ladder-control-bar {
    background: #0e1526;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.control-bar-left, .control-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-start-ladder {
    background: linear-gradient(135deg, #00f5d4 0%, #00bbf9 100%);
    color: #080c16;
    border: none;
    font-size: 14px;
    font-weight: 900;
    padding: 9px 20px;
    border-radius: 7px;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(0, 245, 212, 0.4);
    transition: all 0.2s ease;
}

.btn-start-ladder:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 245, 212, 0.7);
}

.btn-start-ladder:disabled {
    background: #334155;
    color: #64748b;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-reset-ladder {
    background: linear-gradient(135deg, #fee440 0%, #ff9e00 100%);
    color: #080c16;
    border: none;
    font-size: 13px;
    font-weight: 900;
    padding: 9px 18px;
    border-radius: 7px;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(254, 228, 64, 0.5);
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); box-shadow: 0 0 14px rgba(254, 228, 64, 0.4); }
    50% { transform: scale(1.03); box-shadow: 0 0 22px rgba(254, 228, 64, 0.8); }
}

.btn-instant-all, .btn-reset-highlight {
    background: #1e293b;
    border: 1px solid #4cc9f0;
    color: #4cc9f0;
    font-size: 12px;
    font-weight: 800;
    padding: 7px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-instant-all:hover, .btn-reset-highlight:hover {
    background: #4cc9f0;
    color: #080c16;
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.5);
}

.speed-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-speed-opt {
    background: #1e293b;
    border: 1px solid #334155;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 5px;
    cursor: pointer;
}

.btn-speed-opt.active {
    background: #00f5d4;
    color: #080c16;
    border-color: #00f5d4;
    font-weight: 800;
}

/* 🪜 사다리 아레나 뷰 */
.ladder-arena-section {
    background: #090e1a;
    border: 1px solid #1e293b;
    border-radius: 14px;
    padding: 18px 14px;
    overflow-x: auto;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.6);
    min-height: 480px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 2명 미만 시 빈 상태 안내 카드 */
.ladder-empty-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px 16px;
    text-align: center;
    border: 2px dashed #334155;
    border-radius: 12px;
    background: rgba(14, 21, 38, 0.4);
    max-width: 460px;
    width: 100%;
}

.empty-icon {
    font-size: 32px;
}

.empty-title {
    font-size: 15px;
    font-weight: 800;
    color: #00f5d4;
    margin: 0;
}

.empty-desc {
    font-size: 12px;
    color: #94a3b8;
    margin: 0;
    line-height: 1.4;
}

.btn-quick-sample-add {
    background: #1e293b;
    border: 1px solid #00f5d4;
    color: #00f5d4;
    font-size: 12px;
    font-weight: 800;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 4px;
    transition: all 0.2s ease;
}

.btn-quick-sample-add:hover {
    background: #00f5d4;
    color: #080c16;
    box-shadow: 0 0 12px rgba(0, 245, 212, 0.6);
}

.ladder-arena-wrapper {
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* 상단 러너 바 */
.ladder-top-runners {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    padding-bottom: 10px;
}

.runner-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: grab;
    transition: transform 0.15s ease;
    user-select: none;
    box-sizing: border-box;
}

.runner-slot:active {
    cursor: grabbing;
}

.runner-slot.dragging, .outcome-slot.dragging {
    opacity: 0.3;
    transform: scale(0.9);
}

.runner-slot.drag-over .runner-avatar-box, .outcome-slot.drag-over .outcome-box {
    border-color: #00f5d4 !important;
    box-shadow: 0 0 16px rgba(0, 245, 212, 0.8) !important;
    transform: scale(1.08);
}

.runner-slot:hover {
    transform: translateY(-2px);
}

.runner-avatar-box {
    width: 42px;
    height: 42px;
    border-radius: 9px;
    background: #111a2e;
    border: 2px solid #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.runner-slot.active .runner-avatar-box, .runner-slot.highlighted .runner-avatar-box {
    border-color: #00f5d4;
    box-shadow: 0 0 14px rgba(0, 245, 212, 0.7);
}

.runner-name-label {
    font-size: 11.5px;
    font-weight: 800;
    color: #ffffff;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* 캔버스 */
.ladder-canvas {
    background: transparent;
    display: block;
}

/* 하단 당첨 결과 바 */
.ladder-bottom-outcomes {
    display: flex;
    width: 100%;
    justify-content: flex-start;
    padding-top: 10px;
}

.outcome-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-sizing: border-box;
    cursor: grab;
}

.outcome-slot:active {
    cursor: grabbing;
}

.outcome-box {
    padding: 6px 10px;
    border-radius: 7px;
    background: #111a2e;
    border: 1px solid #334155;
    font-size: 11.5px;
    font-weight: 800;
    color: #cbd5e1;
    text-align: center;
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.25s ease;
}

/* 결과 공개 시 유형별 테두리 & 발광 글로우 */
.outcome-box.type-win {
    border-color: #fee440 !important;
    color: #fee440 !important;
    background: rgba(254, 228, 64, 0.16) !important;
    box-shadow: 0 0 14px rgba(254, 228, 64, 0.6) !important;
    transform: scale(1.05);
}

.outcome-box.type-lose {
    border-color: #f72585 !important;
    color: #f72585 !important;
    background: rgba(247, 37, 133, 0.16) !important;
    box-shadow: 0 0 14px rgba(247, 37, 133, 0.6) !important;
    transform: scale(1.05);
}

.outcome-box.type-pass {
    border-color: #00f5d4 !important;
    color: #00f5d4 !important;
    background: rgba(0, 245, 212, 0.16) !important;
    box-shadow: 0 0 12px rgba(0, 245, 212, 0.5) !important;
    transform: scale(1.05);
}

.outcome-box.type-other {
    border-color: #9d4edd !important;
    color: #c77dff !important;
    background: rgba(157, 78, 221, 0.16) !important;
    box-shadow: 0 0 12px rgba(157, 78, 221, 0.5) !important;
    transform: scale(1.05);
}

.outcome-slot.highlighted .outcome-box {
    border-color: #fee440 !important;
    box-shadow: 0 0 18px rgba(254, 228, 64, 0.9) !important;
    transform: scale(1.1) !important;
}

.ladder-hint-bar {
    background: rgba(0, 245, 212, 0.08);
    border: 1px dashed rgba(0, 245, 212, 0.4);
    padding: 7px 12px;
    border-radius: 7px;
    font-size: 11px;
    color: #00f5d4;
    text-align: center;
}

/* 최종 결과 패널 */
.ladder-result-panel {
    background: #0e1526;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease-out;
}

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

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 8px;
}

.result-title {
    font-size: 14px;
    font-weight: 900;
    color: #00f5d4;
    margin: 0;
}

.btn-close-result {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
}

.result-item-card {
    background: #070a12;
    border: 1px solid #1e293b;
    border-radius: 7px;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-item-card.is-win {
    border-color: #fee440;
    background: rgba(254, 228, 64, 0.08);
}

.result-item-card.is-lose {
    border-color: #f72585;
    background: rgba(247, 37, 133, 0.08);
}

.result-player-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 800;
    font-size: 12px;
    color: #ffffff;
}

.result-outcome-text {
    font-weight: 800;
    font-size: 12px;
    color: #fee440;
}

/* 반응형 모바일 (화면 작을 때 세로 1단으로 폴백) */
@media (max-width: 960px) {
    .ladder-main-layout {
        grid-template-columns: 1fr;
    }
}
