/* =============================================
   사다리타기 스타일
   ============================================= */

html { background: #000; }

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

.ld-game {
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    position: relative;
}

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

/* States */
.state-setup { background: #0f0f1a; }
.state-playing { background: #0f0f1a; }
.state-result { background: #0f0f1a; }

/* ===== Setup Screen ===== */
.ld-setup-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
    text-align: center;
}
.ld-setup-desc {
    font-size: 14px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 20px;
    text-align: center;
}

.ld-section-label {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255,255,255,0.7);
    margin-bottom: 8px;
    width: 100%;
    max-width: 360px;
}

.ld-input-row {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 360px;
    margin-bottom: 12px;
}
.ld-input {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 15px;
    outline: none;
}
.ld-input:focus {
    border-color: rgba(255,179,71,0.5);
}
.ld-input::placeholder {
    color: rgba(255,255,255,0.3);
}
.ld-btn-add {
    padding: 12px 18px;
    background: rgba(255,179,71,0.2);
    border: 2px solid rgba(255,179,71,0.4);
    border-radius: 10px;
    color: #FFB347;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.ld-btn-add:active { transform: scale(0.95); }

.ld-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    max-width: 360px;
    margin-bottom: 20px;
    min-height: 36px;
}
.ld-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}
.ld-tag-name {
    background: rgba(78,205,196,0.15);
    color: #4ECDC4;
    border: 1px solid rgba(78,205,196,0.3);
}
.ld-tag-result {
    background: rgba(255,107,107,0.15);
    color: #FF6B6B;
    border: 1px solid rgba(255,107,107,0.3);
}
.ld-tag-remove {
    cursor: pointer;
    opacity: 0.6;
    font-size: 12px;
}
.ld-tag-remove:hover { opacity: 1; }

.ld-btn-start {
    display: inline-block;
    padding: 16px 48px;
    background: linear-gradient(135deg, #FFB347, #FF6B6B);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
    margin-top: 8px;
}
.ld-btn-start:active { transform: scale(0.95); }
.ld-btn-start:disabled {
    opacity: 0.4;
    pointer-events: none;
}

.ld-error {
    color: #FF6B6B;
    font-size: 13px;
    margin-top: 8px;
}

/* ===== Playing Screen ===== */
.ld-canvas-wrap {
    width: 100%;
    max-width: 440px;
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ld-names-row {
    display: flex;
    justify-content: space-around;
    margin-bottom: 4px;
    padding: 0 10px;
}
.ld-name-label {
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(78,205,196,0.15);
    color: #4ECDC4;
    border: 1px solid rgba(78,205,196,0.3);
    transition: all 0.2s;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70px;
}
.ld-name-label:hover {
    background: rgba(78,205,196,0.3);
    border-color: rgba(78,205,196,0.6);
}
.ld-name-label.ld-used {
    opacity: 0.35;
    pointer-events: none;
}

.ld-canvas-area {
    flex: 1;
    min-height: 0;
}
.ld-canvas-area canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.ld-results-row {
    display: flex;
    justify-content: space-around;
    margin-top: 4px;
    padding: 0 10px;
}
.ld-result-label {
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.4);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70px;
}
.ld-result-label.ld-revealed {
    background: rgba(255,107,107,0.15);
    color: #FF6B6B;
    border: 1px solid rgba(255,107,107,0.3);
}

.ld-btn-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
    flex-shrink: 0;
    padding-bottom: 8px;
}
.ld-btn-reveal {
    padding: 12px 24px;
    background: rgba(255,179,71,0.2);
    border: 2px solid rgba(255,179,71,0.4);
    border-radius: 12px;
    color: #FFB347;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.ld-btn-reveal:active { transform: scale(0.95); }

.ld-btn-reset {
    padding: 12px 24px;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    color: rgba(255,255,255,0.7);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.ld-btn-reset:active { transform: scale(0.95); }

/* ===== Result overlay & summary — 공통 game-result.css 사용 ===== */

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