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

body {
    font-family: 'Arial', sans-serif;
    background-color: #2c3e50;
    color: #ecf0f1;
    overflow-x: hidden;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: #34495e;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

h1 {
    font-size: 2.5em;
    color: #3498db;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.save-controls button {
    margin-left: 10px;
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.save-controls button:hover {
    background-color: #2980b9;
}

main {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 20px;
}

.resources-panel, .stats-panel {
    background-color: #34495e;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.resources-panel h2, .stats-panel h2 {
    margin-bottom: 15px;
    color: #3498db;
}

.resource-item, .stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 10px;
    background-color: #2c3e50;
    border-radius: 5px;
}

.resource-amount {
    font-weight: bold;
    color: #2ecc71;
}

.game-area {
    background-color: #34495e;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.targets-container {
    margin-bottom: 30px;
}

.targets-container h2 {
    color: #3498db;
    margin-bottom: 20px;
}

.targets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.target-item {
    background-color: #2c3e50;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.target-item.unlocked:hover {
    transform: scale(1.05);
    border-color: #3498db;
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.target-item.unlocked:active {
    transform: scale(0.95);
}

.target-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.target-image {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.target-item h4 {
    color: #ecf0f1;
    margin-bottom: 5px;
}

.target-item p {
    font-size: 12px;
    color: #bdc3c7;
    margin-bottom: 5px;
}

.target-item .requirement {
    color: #e74c3c;
    font-size: 11px;
}

.upgrade-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #2c3e50;
}

.tab-button {
    flex: 1;
    padding: 15px;
    background-color: transparent;
    color: #bdc3c7;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-button.active {
    color: #3498db;
    border-bottom: 3px solid #3498db;
}

.tab-button:hover {
    background-color: #2c3e50;
}

.tab-panel {
    display: none;
    padding: 20px;
    background-color: #2c3e50;
    border-radius: 10px;
}

.tab-panel.active {
    display: block;
}

.tab-panel h3 {
    margin-bottom: 20px;
    color: #3498db;
}

.tool-item, .npc-item, .upgrade-item {
    padding: 15px;
    margin-bottom: 15px;
    background-color: #34495e;
    border-radius: 8px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.tool-item.owned {
    border-color: #2ecc71;
}

.tool-item.selected {
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.tool-item h4, .npc-item h4, .upgrade-item h4 {
    margin-bottom: 10px;
    color: #ecf0f1;
}

.tool-item p, .npc-item p, .upgrade-item p {
    margin-bottom: 10px;
    font-size: 14px;
}

.cost {
    color: #e74c3c;
    font-size: 12px;
}

.tool-item button, .npc-item button, .upgrade-item button {
    width: 100%;
    padding: 10px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.tool-item button:hover, .npc-item button:hover, .upgrade-item button:hover {
    background-color: #2980b9;
}

.tool-item button:disabled, .npc-item button:disabled, .upgrade-item button:disabled {
    background-color: #7f8c8d;
    cursor: not-allowed;
}

.max-level {
    color: #f39c12;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    background-color: #2c3e50;
    border-radius: 5px;
}

.floating-number {
    position: fixed;
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
    font-size: 24px;
    font-weight: bold;
    color: #2ecc71;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.floating-bonus {
    position: fixed;
    pointer-events: none;
    animation: floatUpBonus 2s ease-out forwards;
    font-size: 28px;
    font-weight: bold;
    color: #f1c40f;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes floatUp {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-50px);
        opacity: 0;
    }
}

@keyframes floatUpBonus {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }
    20% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) scale(1);
        opacity: 0;
    }
}

.unlock-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 40px;
    background-color: #2ecc71;
    color: white;
    font-size: 20px;
    font-weight: bold;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    animation: notificationPop 0.5s ease-out;
}

@keyframes notificationPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #34495e;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    min-width: 400px;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #3498db;
}

.modal-content textarea {
    width: 100%;
    height: 150px;
    padding: 10px;
    margin-bottom: 20px;
    background-color: #2c3e50;
    color: #ecf0f1;
    border: 1px solid #3498db;
    border-radius: 5px;
    font-family: monospace;
    resize: none;
}

.modal-content button {
    margin-right: 10px;
    padding: 10px 20px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.modal-content button:hover {
    background-color: #2980b9;
}

.craft-item, .achievement-item, .prestige-bonus {
    background-color: #34495e;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.craft-formula {
    color: #f39c12;
    font-family: monospace;
    margin: 10px 0;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.achievement-item i {
    font-size: 2em;
    color: #95a5a6;
}

.achievement-item.unlocked i {
    color: #f39c12;
}

.achievement-item.locked {
    opacity: 0.5;
}

.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #27ae60;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideIn 0.5s ease-out;
    z-index: 1000;
}

.achievement-notification i {
    font-size: 2em;
    color: #f39c12;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.prestige-stats {
    background-color: #2c3e50;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.prestige-requirements p {
    margin: 5px 0;
}

.prestige-requirements .met {
    color: #27ae60;
}

.prestige-requirements .unmet {
    color: #e74c3c;
}

.prestige-button {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    background-color: #9b59b6;
    margin-top: 20px;
}

.prestige-button:hover:not(:disabled) {
    background-color: #8e44ad;
}

.prestige-bonus .maxed {
    color: #f39c12;
    text-align: center;
    font-weight: bold;
}

@media (max-width: 1200px) {
    main {
        grid-template-columns: 1fr;
    }
    
    .resources-panel, .stats-panel {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 10px;
    }
    
    .resources-panel h2, .stats-panel h2 {
        grid-column: 1 / -1;
    }
}

/* メッセージモーダル */
.message-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    animation: slideInMessage 0.3s ease-out;
}

.message-modal.fade-out {
    animation: fadeOutMessage 0.3s ease-out forwards;
}

.message-content {
    background-color: #34495e;
    padding: 20px 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 300px;
}

.message-modal.success .message-content {
    border: 2px solid #27ae60;
    background-color: #2c3e50;
}

.message-modal.error .message-content {
    border: 2px solid #e74c3c;
    background-color: #2c3e50;
}

.message-content i {
    font-size: 24px;
}

.message-modal.success i {
    color: #27ae60;
}

.message-modal.error i {
    color: #e74c3c;
}

.message-content p {
    margin: 0;
    font-size: 16px;
    color: #ecf0f1;
}

.message-content button {
    margin-left: 20px;
    padding: 8px 16px;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.message-content button:hover {
    background-color: #c0392b;
}

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@keyframes fadeOutMessage {
    from {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
    to {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
}

/* ロードヘルプ */
.load-help {
    margin-top: 20px;
    padding: 15px;
    background-color: #2c3e50;
    border-radius: 8px;
    border: 1px solid #34495e;
}

.load-help p {
    margin: 8px 0;
    font-size: 14px;
    color: #bdc3c7;
    display: flex;
    align-items: center;
    gap: 8px;
}

.load-help i {
    font-size: 16px;
}

.load-help .fa-info-circle {
    color: #3498db;
}

.load-help .fa-exclamation-triangle {
    color: #f39c12;
}

/* 自動セーブ通知アニメーション */
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(20px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}