/* ==============================================
   Macross Delta Character Sorter CSS
   Version: 2024.01.05-v2 (Order Fix Update)
   キャッシュバスティング: スタートボタン→キャラ情報の順序修正
   ============================================== */

/* マクロスΔキャラクターソート - メインCSS */
/* Phase 3: スタイル実装 */

:root {
    --primary-color: #1a1a2e;
    --secondary-color: #16213e;
    --accent-color: #e74c3c;
    --text-light: #ffffff;
    --text-dark: #2c3e50;
    --bg-gradient: linear-gradient(135deg, #1a1a2e, #16213e, #0f0f3a);
    --card-bg: rgba(255, 255, 255, 0.1);
    --border-color: rgba(255, 255, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-light);
    min-height: 100vh;
    line-height: 1.6;
}

/* ヘッダー */
.macross-delta-header {
    text-align: center;
    padding: 40px 20px;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    order: 0;
}

.macross-delta-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(255, 107, 107, 0.3);
}

.macross-delta-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.character-count {
    font-size: 0.9rem;
    color: #4ecdc4;
    font-weight: 500;
}

/* ローディング */
.loading-message {
    text-align: center;
    padding: 60px 20px;
    order: 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #4ecdc4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* エラーメッセージ */
.error-message {
    text-align: center;
    padding: 40px 20px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    margin: 20px 0;
    order: 0;
}

.error-message h3 {
    color: #e74c3c;
    margin-bottom: 15px;
}

.retry-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 15px;
    transition: background 0.3s ease;
}

.retry-btn:hover {
    background: #c0392b;
}

/* キャラクター選択画面 */
.character-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 20px;
}

.comparison-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 800px;
    width: 100%;
}

.character-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    min-width: 280px;
    flex: 1;
    max-width: 350px;
}

.character-card:hover {
    transform: translateY(-5px);
    border-color: #4ecdc4;
    box-shadow: 0 10px 30px rgba(78, 205, 196, 0.3);
}

.character-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 15px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
}

.character-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-light);
}

.character-description {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.4;
    margin-bottom: 8px;
}

.character-group {
    font-size: 0.8rem;
    color: #4ecdc4;
    font-weight: 500;
    background: rgba(78, 205, 196, 0.2);
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 8px;
}

.vs-divider {
    font-size: 2rem;
    font-weight: bold;
    color: #e74c3c;
    padding: 0 20px;
}

/* プログレスバー */
.progress-container {
    width: 100%;
    max-width: 600px;
    margin-bottom: 30px;
}

.progress-text {
    text-align: center;
    margin-bottom: 10px;
    font-weight: 400;
    font-size: 0.9rem;
    opacity: 0.8;
    color: #4ecdc4;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #45b7d1);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* 結果画面 */
.result-container {
    text-align: center;
    padding: 40px 20px;
}

.result-title {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #4ecdc4;
}

.ranking-list {
    max-width: 600px;
    margin: 0 auto;
}

.ranking-item {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    backdrop-filter: blur(10px);
}

.ranking-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6b6b;
    margin-right: 20px;
    min-width: 40px;
}

.ranking-character {
    flex: 1;
    text-align: left;
    display: flex;
    align-items: center;
}

.ranking-character-avatar {
    margin-right: 15px;
    flex-shrink: 0;
}

.ranking-character-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-light);
}

/* コントロールボタン */
.control-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

.btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-x {
    background: #000000;
    color: white;
}

.btn-x:hover {
    background: #333333;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .macross-delta-header h1 {
        font-size: 2rem;
    }
    
    .comparison-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .vs-divider {
        transform: rotate(90deg);
        font-size: 1.5rem;
    }
    
    .character-card {
        min-width: 100%;
        max-width: 100%;
    }
    
    .control-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
}

/* アニメーション効果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.character-selection,
.result-container {
    animation: fadeIn 0.5s ease-out;
}

/* フォーカス可能な要素のアクセシビリティ */
.character-card:focus,
.btn:focus {
    outline: 2px solid #4ecdc4;
    outline-offset: 2px;
}

/* ==============================================
   キャラクター情報エリア - 統一されたデザイン
   ============================================== */

/* キャラクター情報メインコンテナ */
.macross-delta-info {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    margin: 30px 0;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease-out;
}

/* 情報グリッドレイアウト */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* 各グループ情報カード - character-cardと統一 */
.info-item {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    text-align: center;
}

.info-item:hover {
    transform: translateY(-5px);
    border-color: #4ecdc4;
    box-shadow: 0 10px 30px rgba(78, 205, 196, 0.3);
}

/* グループタイトル - character-nameと統一 */
.info-item-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* グループ別カラー */
.info-item:nth-child(1) .info-item-title {
    color: #ff6b6b; /* ワルキューレ - 赤系 */
}

.info-item:nth-child(2) .info-item-title {
    color: #4ecdc4; /* ケイオス - 青緑系 */
}

.info-item:nth-child(3) .info-item-title {
    color: #45b7d1; /* ウィンダミア王国 - 青系 */
}

/* キャラクター名リスト - character-descriptionと統一 */
.info-item p {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.4;
    margin: 0;
    color: var(--text-light);
}

/* スタートボタンエリア */
.macross-delta-start {
    text-align: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    backdrop-filter: blur(10px);
}

/* スタートボタン本体 - btnと統一感 */
.start-btn {
    background: linear-gradient(135deg, #4ecdc4 0%, #45b7d1 100%);
    border: none;
    border-radius: 6px;
    padding: 18px 36px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 200px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.4);
    background: linear-gradient(135deg, #45b7d1 0%, #4ecdc4 100%);
}

.start-btn:active {
    transform: translateY(0);
}

/* ボタンテキストスタイル */
.btn-text {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.btn-subtitle {
    display: block;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 400;
}

/* スタート説明テキスト */
.start-note {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 15px;
    opacity: 0.8;
}

/* レスポンシブ対応の拡張 */
@media (max-width: 768px) {
    .macross-delta-info {
        padding: 20px;
        margin: 20px 0;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .info-item {
        padding: 15px;
    }
    
    .info-item-title {
        font-size: 1.1rem;
    }
    
    .start-btn {
        padding: 15px 30px;
        font-size: 1rem;
        min-width: 180px;
    }
    
    .macross-delta-start {
        padding: 20px;
    }
}

/* ==============================================
   要素の表示順序制御 - 強化版
   ============================================== */

/* メインコンテナの設定を強化 */
.macross-delta-container,
#macross-delta-sorter {
    display: flex !important;
    flex-direction: column !important;
}

/* スタートボタンエリアを最初に表示 */
#sortStart,
.macross-delta-start {
    order: 1 !important;
}

/* キャラクター情報エリアを2番目に表示 */
#characterInfo,
.macross-delta-info {
    order: 2 !important;
}

/* ヘッダーエリア */
.macross-delta-header {
    order: 0 !important;
}

/* ローディング・エラー */
.loading-message,
.error-message {
    order: 0 !important;
} 