/* ====================================================
   스타포스 시뮬레이터 스타일
   ==================================================== */
.sf-sim-container { max-width: 1100px; margin: 0 auto; padding: 40px 20px 80px; }
.sf-sim-header { text-align: center; margin-bottom: 30px; }
.sf-sim-header h1 { font-size: 28px; color: #3C3744; margin: 0 0 8px; }
.sf-sim-sub { color: #666; font-size: 14px; margin: 0; }

.setup-card, .sim-area {
    background: #fff; border: 1px solid #e6e8ef; border-radius: 12px;
    padding: 24px; margin-bottom: 22px;
}

.field-group { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: #3C3744; margin-bottom: 6px; }
.field-hint  { font-size: 11px; color: #888; margin: 6px 0 0; }
.field-group input[type="number"] {
    width: 100%; padding: 10px;
    border: 1px solid #e6e8ef; border-radius: 8px;
    font-size: 14px; box-sizing: border-box;
}

.event-toggles {
    display: flex; flex-wrap: wrap; gap: 10px;
    background: #f8f9fb; padding: 14px; border-radius: 8px;
}
.event-toggle {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; background: #fff;
    border: 1px solid #e6e8ef; border-radius: 8px;
    cursor: pointer; font-size: 13px;
    transition: border-color 0.12s, background 0.12s;
}
.event-toggle:has(input:checked) { border-color: #f39c12; background: #fff8e7; }
.event-toggle input { margin: 0; }

.revival-label-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
}
.revival-all-btn {
    background: #fff; border: 1px solid #ccd3e0; border-radius: 6px;
    padding: 4px 12px; font-size: 11px; font-weight: 600; color: #666;
    cursor: pointer;
}
.revival-all-btn:hover { background: #f4f5f9; color: #3C3744; }
.revival-all-btn.active { background: #3C3744; color: #fff; border-color: #3C3744; }

.apply-btn {
    width: 100%; padding: 14px;
    background: #3C3744; color: #fff;
    border: 0; border-radius: 10px;
    font-size: 16px; font-weight: 700;
    cursor: pointer;
}
.apply-btn:hover { background: #2a2530; }

/* ===== 별 표시 ===== */
.star-display {
    display: flex; align-items: center; gap: 24px;
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: #fff; border-radius: 12px;
    padding: 24px; margin-bottom: 20px;
}
.star-current { flex-shrink: 0; }
.star-current-label { font-size: 12px; opacity: 0.7; margin-bottom: 4px; }
.star-current-value { font-size: 42px; font-weight: 800; color: #f39c12; line-height: 1; }
.star-current-sub { font-size: 12px; opacity: 0.8; margin-top: 6px; }
.star-visualization {
    flex: 1; display: flex; flex-wrap: wrap; gap: 4px;
}
.star-icon {
    font-size: 16px; color: #444; opacity: 0.4;
    transition: color 0.2s, opacity 0.2s;
}
.star-icon.active { color: #f39c12; opacity: 1; text-shadow: 0 0 6px rgba(243, 156, 18, 0.6); }

/* ===== 통계 ===== */
.stats-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 12px; margin-bottom: 18px;
}
.stat-card {
    background: #f8f9fb; border-radius: 10px;
    padding: 14px; text-align: center;
}
.stat-label { font-size: 11px; color: #888; margin-bottom: 6px; }
.stat-value { font-size: 18px; font-weight: 800; color: #3C3744; }

/* ===== 액션 버튼 ===== */
.action-row { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.action-btn {
    flex: 1; min-width: 140px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e6e8ef;
    border-radius: 10px;
    font-size: 14px; font-weight: 700;
    color: #3C3744;
    cursor: pointer;
}
.action-btn.primary { background: #f39c12; border-color: #f39c12; color: #fff; }
.action-btn.primary:hover { background: #e67e22; }
.action-btn.warn { color: #e53935; }
.action-btn.warn:hover { background: #fee; }
.action-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== 자동 강화 패널 ===== */
.auto-panel {
    background: #f8f9fb; border-radius: 10px;
    padding: 18px; margin-bottom: 18px;
}
.auto-panel h3 { margin: 0 0 14px; font-size: 14px; color: #3C3744; }
.auto-actions { display: flex; gap: 10px; margin-top: 8px; }
.auto-progress { margin-top: 14px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; }
.progress-bar { height: 8px; background: #e6e8ef; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: #f39c12; transition: width 0.2s; }

/* ===== 히스토리 ===== */
.history-section {
    background: #fff; border: 1px solid #e6e8ef; border-radius: 10px;
    padding: 16px;
}
.history-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.history-header h3 { margin: 0; font-size: 14px; color: #3C3744; }
.clear-history-btn {
    background: #fff; border: 1px solid #e6e8ef;
    padding: 5px 12px; border-radius: 6px;
    font-size: 11px; color: #999; cursor: pointer;
}
.history-list { max-height: 360px; overflow-y: auto; }
.empty-hint { text-align: center; color: #aab0c0; font-size: 12px; padding: 16px 0; }
.history-row {
    display: grid;
    grid-template-columns: 50px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 12px;
    border-bottom: 1px solid #f4f5f9;
}
.history-row:last-child { border-bottom: 0; }
.h-idx { color: #aab0c0; font-family: 'Courier New', monospace; font-size: 11px; }
.h-state { color: #3C3744; }
.h-cost { color: #888; font-family: 'Courier New', monospace; }

.history-row.is-success .h-state { color: #27ae60; font-weight: 700; }
.history-row.is-maintain .h-state { color: #888; }
.history-row.is-drop .h-state { color: #e67e22; }
.history-row.is-destroy { background: #fef0f0; }
.history-row.is-destroy .h-state { color: #e53935; font-weight: 700; }

.error-banner {
    background: #fee; border: 1px solid #f99;
    border-radius: 8px; padding: 14px;
    color: #991b1b; font-size: 13px;
    margin-bottom: 16px;
}

@media (max-width: 720px) {
    .sf-sim-container { padding: 22px 12px 60px; }
    .sf-sim-header h1 { font-size: 22px; }
    .sf-sim-sub { font-size: 13px; }

    /* 입력/시뮬 영역 패딩 축소 */
    .setup-card, .sim-area { padding: 16px; }
    .field-row { grid-template-columns: 1fr; gap: 12px; }

    /* 파괴방지/확정복구 라벨 + 버튼 */
    .revival-label-row { flex-wrap: wrap; gap: 8px; }
    .revival-all-btn { font-size: 10px; padding: 4px 10px; }

    /* 별 표시 영역 */
    .star-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding: 18px 16px;
    }
    .star-visualization { width: 100%; }
    .star-current-value { font-size: 36px; }

    /* 통계 카드 — 3-column 으로 조정 */
    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .stat-card { padding: 12px 8px; }
    .stat-label { font-size: 10px; }
    .stat-value { font-size: 15px; }

    /* 액션 버튼 */
    .action-row { gap: 8px; }
    .action-btn { min-width: 0; padding: 11px; font-size: 13px; }

    /* 히스토리 */
    .history-section { padding: 14px 12px; }
    .history-row { grid-template-columns: 40px 1fr auto; padding: 6px 8px; font-size: 11px; }
    .history-list { max-height: 320px; }
}

@media (max-width: 480px) {
    .sf-sim-container { padding: 18px 10px 50px; }
    .setup-card, .sim-area { padding: 14px 12px; }

    /* 이벤트 토글 */
    .event-toggles { padding: 10px; gap: 6px; }
    .event-toggle { padding: 7px 10px; font-size: 12px; }

    /* 통계 카드 — 2-column */
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    /* 별 표시 */
    .star-current-value { font-size: 30px; }

    /* 액션 버튼 — 세로 */
    .action-row { flex-direction: column; }
    .action-btn { width: 100%; }
}
