* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #333;
    height: 100svh;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.container {
    height: 100svh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 3px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

header {
    text-align: center;
    margin-bottom: 5px;
    flex-shrink: 0;
}

header h1 {
    color: white;
    font-size: 1rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin: 3px 0;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 3px;
    margin-bottom: 5px;
    flex: 1;
    min-height: 0;
}

.resource-card {
    background: white;
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    border-top: 2px solid;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    min-height: 0;
}

.resource-card:hover {
    transform: translateY(-2px);
}

.resource-card.mc {
    border-top-color: #f39c12;
}

.resource-card.steel {
    border-top-color: #95a5a6;
}

.resource-card.titanium {
    border-top-color: #3498db;
}

.resource-card.plants {
    border-top-color: #27ae60;
}

.resource-card.energy {
    border-top-color: #f1c40f;
}

.resource-card.heat {
    border-top-color: #e74c3c;
}

.resource-header {
    text-align: center;
    margin-bottom: 3px;
    flex-shrink: 0;
}

.resource-header h2 {
    font-size: 0.75rem;
    margin-bottom: 1px;
}

.resource-info {
    font-size: 0.55rem;
    color: #666;
    font-weight: 500;
}

.counter-section {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    flex: 1;
    min-height: 0;
    gap: 2px;
}

.counter-section > div {
    text-align: center;
    border-radius: 6px;
    padding: 4px;
}

.counter-section .production {
    background: #A0826D;
    border: 1px solid #8B7355;
    color: white;
}

.counter-section .production label {
    color: white;
}

.counter-section .resources {
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.1);
}

.counter-section label {
    display: block;
    font-weight: bold;
    margin-bottom: 2px;
    color: #555;
    font-size: 0.65rem;
}

.counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-decrease,
.btn-increase {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(52, 152, 219, 0.3);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-decrease:hover,
.btn-increase:hover {
    background: #2980b9;
    transform: scale(1.05);
}

.btn-decrease:active,
.btn-increase:active {
    transform: scale(0.95);
}

.btn-decrease {
    background: #e74c3c;
    box-shadow: 0 2px 10px rgba(231, 76, 60, 0.3);
}

.btn-decrease:hover {
    background: #c0392b;
}

.value {
    font-size: 1rem;
    font-weight: bold;
    min-width: 30px;
    color: #2c3e50;
}

.action-button {
    width: 100%;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.action-button:hover {
    background: #229954;
    transform: translateY(-1px);
}

.action-button:active {
    transform: translateY(0);
}

.action-button:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 10px;
}

.modal-overlay.show {
    display: flex;
    animation: modalFadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 15px 10px 15px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin: 0;
}

.modal-close {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.modal-close:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.modal-body {
    padding: 15px;
}

.card-input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.cost-input {
    text-align: center;
}

.cost-input label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    color: #555;
}

.cost-input input {
    width: 100%;
    padding: 15px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

.cost-input input:focus {
    outline: none;
    border-color: #9b59b6;
    background: white;
}

.card-type {
    text-align: center;
}

.card-type label {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    color: #555;
}

.card-type-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.card-type-btn {
    background: #ecf0f1;
    border: 2px solid #bdc3c7;
    color: #555;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.card-type-btn:hover {
    background: #d5dbdb;
    border-color: #95a5a6;
}

.card-type-btn.active {
    background: #9b59b6;
    border-color: #8e44ad;
    color: white;
}

.card-type-btn.active:hover {
    background: #8e44ad;
}

.control-buttons {
    display: flex;
    gap: 3px;
    justify-content: center;
    flex-wrap: nowrap;
    flex-shrink: 0;
    padding: 3px 0;
}

.control-btn {
    padding: 8px 10px;
    font-size: 0.7rem;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.production-btn {
    background: #8e44ad;
    color: white;
    box-shadow: 0 2px 8px rgba(142, 68, 173, 0.4);
}

.production-btn:hover {
    background: #7d3c98;
    transform: translateY(-1px);
}

.card-btn {
    background: #f39c12;
    color: white;
    box-shadow: 0 2px 8px rgba(243, 156, 18, 0.4);
}

.card-btn:hover {
    background: #e67e22;
    transform: translateY(-1px);
}

.reset-btn {
    background: #34495e;
    color: white;
    box-shadow: 0 2px 8px rgba(52, 73, 94, 0.4);
}

.reset-btn:hover {
    background: #2c3e50;
    transform: translateY(-1px);
}

.control-btn:active {
    transform: translateY(0);
}


/* Modal Animations */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Tab Styles */
.modal-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #2c3e50;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Standard Projects Styles */
.standard-projects {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.project-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #e0e0e0;
}

.project-item h3 {
    font-size: 0.9rem;
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.project-item p {
    font-size: 0.7rem;
    color: #666;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.project-btn {
    padding: 8px 12px;
    font-size: 0.75rem;
}

/* Resource Actions Styles */
.resource-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.resource-action {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid #e0e0e0;
}

.resource-action h3 {
    font-size: 0.9rem;
    margin: 0 0 5px 0;
    color: #2c3e50;
}

.resource-action p {
    font-size: 0.7rem;
    color: #666;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.resource-btn {
    padding: 8px 12px;
    font-size: 0.75rem;
}

@keyframes modalSlideIn {
    from { 
        transform: scale(0.8) translateY(-20px);
        opacity: 0;
    }
    to { 
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

