:root {
    --bg-color: #111;
    --text-color: #eee;
    --primary-color: #4CAF50;
    --secondary-color: #555;
    --danger-color: #f44336;
    --accent-color: #ffeb3b;
    --pitch-color: #2e7d32;
    --font-pixel: 'Press Start 2P', 'DotGothic16', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background-color: var(--bg-color); color: var(--text-color);
    font-family: var(--font-pixel); line-height: 1.6; overflow-x: hidden; font-size: 14px;
}

#app { max-width: 900px; margin: 0 auto; padding: 20px 20px 80px 20px; }

header { background: #222; padding: 15px; border: 2px solid #444; border-radius: 8px; margin-bottom: 20px; }
h1 { font-size: 1.5rem; margin-bottom: 10px; color: var(--primary-color); text-shadow: 2px 2px 0 #000; }
.stats-row { display: flex; gap: 20px; font-size: 0.9rem; flex-wrap: wrap; }
.stat-item { background: #000; padding: 5px 10px; border: 1px solid #444; border-radius: 4px; }

.view { display: none; animation: fadeIn 0.3s ease-in; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

h2 { margin-bottom: 15px; border-bottom: 2px solid #444; padding-bottom: 5px; }

.btn {
    font-family: var(--font-pixel); background: var(--secondary-color); color: white;
    border: 2px solid #888; padding: 10px 15px; cursor: pointer; font-size: 0.9rem;
    border-radius: 4px; transition: all 0.1s; margin: 5px;
}
.btn:hover:not(:disabled) { transform: scale(1.05); background: #666; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--primary-color); border-color: #81c784; }
.btn.primary:hover:not(:disabled) { background: #43a047; }
.btn.danger { background: var(--danger-color); border-color: #e57373; }
.btn.danger:hover:not(:disabled) { background: #e53935; }

.dashboard-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Facilities */
.facilities-container { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 20px; }
.facility-card { background: #222; border: 2px solid #555; padding: 15px; border-radius: 8px; flex: 1 1 250px; text-align: center; }
.facility-card h3 { margin-bottom: 10px; color: var(--accent-color); }
.facility-card p { font-size: 0.8rem; margin-bottom: 10px; color: #ccc; }

/* Standings Table */
.standings-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; background: #222; text-align: center;}
.standings-table th, .standings-table td { border: 1px solid #444; padding: 10px; }
.standings-table th { background: #333; color: var(--accent-color); }
.standings-table tr:nth-child(1) { font-weight: bold; color: var(--accent-color); } /* 1位強調 */

/* Team View */
.team-layout { display: flex; gap: 20px; margin-bottom: 20px; }
.pitch-layout {
    width: 300px; height: 400px; background: var(--pitch-color);
    border: 2px solid #fff; position: relative;
}
.roster-list { flex: 1; background: #222; padding: 10px; border: 2px solid #444; max-height: 400px; overflow-y: auto;}
.roster-item {
    padding: 8px; border-bottom: 1px solid #444; cursor: pointer; display: flex; justify-content: space-between;
}
.roster-item:hover { background: #333; }
.roster-item.selected { background: var(--primary-color); color: #000; }
.roster-item.starting { border-left: 4px solid var(--accent-color); }

.pitch-player {
    position: absolute; width: 24px; height: 24px; background: #000; border: 2px solid #fff;
    border-radius: 50%; display: flex; justify-content: center; align-items: center;
    transform: translate(-50%, -50%); cursor: pointer; font-size: 10px;
}
.pitch-player.selected { border-color: var(--accent-color); box-shadow: 0 0 10px var(--accent-color); }
.pitch-player.mob { background: #555; }
.pitch-player.star { background: var(--accent-color); color: #000; font-weight: bold; }

/* Scout View */
.scout-results { display: flex; gap: 15px; flex-wrap: wrap; margin-bottom: 20px; }
.candidate-card {
    background: #222; border: 2px solid #555; padding: 15px; border-radius: 8px;
    width: 100%; max-width: 250px; cursor: pointer; transition: transform 0.1s, border-color 0.1s;
}
.candidate-card:hover { transform: translateY(-5px); border-color: var(--primary-color); }

/* Training View */
.training-panel { background: #222; padding: 20px; border-radius: 8px; border: 2px solid #444; margin-bottom: 20px; }
.stat-train-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 5px; background: #000; border: 1px solid #333; }
.btn-train { background: var(--primary-color); color: white; border: none; width: 30px; height: 30px; font-family: monospace; font-size: 1.2rem; cursor: pointer; }

.skill-panel { background: #222; padding: 20px; border-radius: 8px; border: 2px solid #444; margin-bottom: 20px; }

.aura-container { text-align: center; margin: 20px 0; height: 100px; display: flex; justify-content: center; align-items: center; }
.pixel-sprite-display { width: 48px; height: 48px; background-color: #ffccaa; border: 2px solid #000; transition: box-shadow 0.3s; }
.aura-blue { box-shadow: 0 0 20px 10px rgba(33, 150, 243, 0.5); }
.aura-red { box-shadow: 0 0 30px 15px rgba(244, 67, 54, 0.7); }
.aura-gold { box-shadow: 0 0 50px 20px rgba(255, 193, 7, 0.9); }
.aura-rainbow { animation: rainbow 1s linear infinite; }
@keyframes rainbow {
    0% { box-shadow: 0 0 80px 30px rgba(255,0,0,1); }
    33% { box-shadow: 0 0 80px 30px rgba(0,255,0,1); }
    66% { box-shadow: 0 0 80px 30px rgba(0,0,255,1); }
    100% { box-shadow: 0 0 80px 30px rgba(255,0,0,1); }
}

/* Match View */
.match-header { background: #222; padding: 10px; border: 2px solid #444; margin-bottom: 10px; text-align: center; }
.score-board { font-size: 1.5rem; font-weight: bold; display: flex; justify-content: center; gap: 20px; margin-bottom: 10px; }
.tactics-selector { display: flex; justify-content: center; gap: 10px; align-items: center; margin-top: 10px; }
.btn-tactic {
    font-family: var(--font-pixel); background: #333; color: #aaa;
    border: 2px solid #555; padding: 6px 10px; cursor: pointer; font-size: 0.75rem;
    border-radius: 4px; transition: all 0.1s;
}
.btn-tactic.selected { border-color: var(--accent-color); color: var(--accent-color); box-shadow: 0 0 8px var(--accent-color); background: #2a2a00; }
.btn-tactic:hover { background: #444; }
.btn-order {
    font-family: var(--font-pixel); background: #333; color: #aaa;
    border: 2px solid #555; padding: 5px 9px; cursor: pointer; font-size: 0.7rem;
    border-radius: 4px; transition: all 0.1s;
}
.btn-order.selected { border-color: #4CAF50; color: #4CAF50; box-shadow: 0 0 8px #4CAF50; background: #002200; }
.btn-order:hover { background: #444; }
.canvas-container { width: 100%; display: flex; justify-content: center; border: 4px solid #555; background: #1a1a1a; position: relative; overflow: hidden; }
canvas { image-rendering: pixelated; max-width: 100%; }
.match-log { margin-top: 10px; height: 100px; background: #000; border: 1px solid #444; padding: 10px; overflow-y: scroll; font-size: 0.8rem; color: #aaa; }

.hidden { display: none !important; }

/* Modal */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center;
    z-index: 1000;
}
.modal-content {
    background: #222; padding: 30px; border: 4px solid var(--accent-color);
    border-radius: 8px; text-align: center; max-width: 400px;
}
.offer-amount { font-size: 1.5rem; color: var(--accent-color); margin: 20px 0; font-weight: bold; }

/* Title Screen */
.title-slot-btn {
    width: 340px;
}
.title-slot-btn button {
    font-family: var(--font-pixel);
    background: #1a1a1a;
    color: #ccc;
    border: 2px solid #555;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
}
.title-slot-btn button:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: #2a2a00;
}
