:root {
    --primary: #3b82f6;
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #1f2937;
    --button: #6b7280;
}
body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 20px;
}
.container {
    max-width: 800px;
    margin: 0 auto;
}
h1 { text-align: center; color: var(--primary); }

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }

.card {
    background: var(--card);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.card h2 { margin-top: 0; }
.card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

label { display: block; margin-top: 10px; font-weight: bold; font-size: 0.9rem; }
select, input {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

.action-area {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 30px 0;
}
button#run-btn, button#analyze-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
button#analyze-btn {
    background: #6b7280;
}
button#run-btn:hover { background: #2563eb; }
button#analyze-btn:hover { background: #4b5563; }
button#run-btn:disabled, button#analyze-btn:disabled { background: #9ca3af; cursor: not-allowed; }

#results {
    display: none;
    background: #10b981;
    color: white;
    text-align: center;
}

#analysis-results {
    display: none;
}
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Increased gap */
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 20px;
}
.chart-bar-wrapper {
    display: grid;
    grid-template-columns: 150px 1fr; /* Label column and bar column */
    align-items: center;
    gap: 10px;
}
.chart-bar-label {
    font-size: 0.8em;
    text-align: right;
    color: var(--text);
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.3;
}
.chart-label-name {
    font-weight: bold;
    font-size: 1.1em;
}
.chart-label-level {
    font-weight: normal;
    font-size:0.8em;
    color: #666;
}
.chart-label-details {
    font-size: 0.9em;
    color: #6b7280;
}
.chart-label-moves {
    font-size: 0.85em;
    color: #4b5563;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chart-bars-container {
    display: flex;
    flex-direction: column;
    gap: 4px; /* Space between DPS and TDO bars */
}
.chart-bar {
    background: var(--primary);
    color: white;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    border-radius: 4px;
    transition: width 0.5s ease-out;
    white-space: nowrap;
    overflow: hidden;
}
.bar-value {
    font-size: 0.9em;
    font-weight: bold;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 15px;
}
.stat-box {
    background: rgba(255,255,255,0.2);
    padding: 10px;
    border-radius: 8px;
}
.stat-val { font-size: 1.5rem; font-weight: bold; }
.stat-label { font-size: 0.8rem; opacity: 0.9; }

/* Team List Styles */
.team-item {
    background: #f9fafb;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e5e7eb;
    transition: background 0.2s, border-color 0.2s;
}
.team-item:hover { background: #f3f4f6; border-color: #d1d5db; }

.team-info {
    flex-grow: 1;
    padding-right: 10px;
}
.team-name { font-weight: bold; font-size: 0.95rem; color: var(--text); }
.team-details { font-size: 0.75rem; color: #6b7280; margin-top: 2px; }

.team-actions {
    display: flex;
    gap: 4px;
}
.btn-icon {
    background: white;
    border: 1px solid #d1d5db;
    color: #4b5563;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}
.btn-icon:hover { background: #e5e7eb; color: #111; }
.btn-icon:disabled { opacity: 0.3; cursor: default; }
.btn-remove { color: #ef4444; border-color: #fecaca; }
.btn-remove:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

.form-grid-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: end;
}
.form-grid-half input[type="checkbox"] {
    width: 24px;
    height: 24px;
    justify-self: center;
}
.form-tag {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7em;
    margin-left: 5px;
    vertical-align: middle;
    color: white;
}
.form-tag-mega { background: #a040a0; }
.form-tag-primal { background: #c00000; }
.form-tag-alolan { background: #00b0e0; }
.form-tag-galarian { background: #a0a0a0; }
.form-tag-shadow { background: #7c3aed; }
.lang-dropdown {
    position: relative;
    display: inline-block;
}
.lang-btn {
    cursor: pointer;
    width: max-content;
    background-color: var(--button); /* Using --button for consistency with other buttons in index.html's style */
    color: white; /* White text for primary button */
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.lang-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.lang-dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--card); /* Using --card for dropdown background */
    width: max-content;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 8px;
    overflow: hidden;
}
.lang-dropdown-content a {
    color: var(--text); /* Using --text for dropdown item text */
    padding: 10px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    white-space: nowrap;
}
.lang-dropdown-content a:hover {
    background-color: #f1f1f1; /* Light hover effect for card background */
}
.lang-dropdown:hover .lang-dropdown-content {
    display: block;
}
.modal {
    display: none; 
    position: fixed; 
    z-index: 1; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgb(0,0,0); 
    background-color: rgba(0,0,0,0.4); 
}
.modal-content {
    background-color: #fefefe;
    margin: 15% auto; 
    padding: 20px;
    border: 1px solid #888;
    width: 80%; 
    max-width: 500px;
    border-radius: 12px;
}
.close-btn {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}
.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.accordion {
    background-color: #eee;
    color: #444;
    cursor: pointer;
    padding: 18px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 15px;
    transition: 0.4s;
}
.active, .accordion:hover {
    background-color: #ccc;
}
.panel {
    padding: 0 18px;
    background-color: white;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
}
.log-display {
    white-space: pre-wrap;
    font-family: monospace;
    background: #f4f4f4;
    padding: 10px;
    border-radius: 5px;
    max-height: 300px;
    overflow-y: auto;
}