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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.randomizer-section {
    padding: 30px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-bottom: 1px solid #e0e0e0;
}

.randomizer-section h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
}

.randomizer-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.randomizer-options h3,
.trait-mode-selection h3 {
    margin-bottom: 10px;
    font-size: 1.2em;
}

.checkbox-group,
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.checkbox-group label,
.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    transition: background 0.3s;
}

.checkbox-group label:hover,
.radio-group label:hover {
    background: rgba(255, 255, 255, 0.3);
}

.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.trait-mode-selection {
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.form-section {
    padding: 30px;
    border-bottom: 1px solid #e0e0e0;
}

.form-section:last-child {
    border-bottom: none;
}

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.form-section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.form-section h3 {
    color: #764ba2;
    margin: 20px 0 10px 0;
    font-size: 1.3em;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
}

.form-group input,
.form-group select optgroup {
    font-weight: bold;
    font-size: 0.9em;
    color: #667eea;
    background-color: #f5f5f5;
    padding: 5px 0;
}

.form-group select {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
    position: relative;
    z-index: 1;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    margin-top: 5px;
    color: #888;
    font-size: 0.85em;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
    cursor: pointer;
}

.skill-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
}

.skill-item h4 {
    color: #667eea;
    margin-bottom: 10px;
}

.skill-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.skill-level {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skill-level input[type="range"] {
    width: 200px;
}

.skill-level span {
    min-width: 30px;
    font-weight: bold;
    color: #667eea;
}

.traits-section {
    margin-top: 20px;
}

.required-traits {
    background: #e8f5e9;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.required-traits .trait-tag {
    background: #4caf50;
    color: white;
}

.selected-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
    min-height: 50px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.trait-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 0.9em;
    margin: 4px;
    position: relative;
}

.trait-tag-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trait-name {
    font-weight: 500;
}

.trait-buffs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.trait-buff {
    display: inline-block;
    padding: 2px 6px;
    background: #ffd700;
    color: #333;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    border: 1px solid #ffed4e;
    white-space: nowrap;
}

.trait-buff.positive {
    background: #ffd700;
    color: #333;
}

.trait-buff.negative {
    background: #ff6b6b;
    color: white;
    border-color: #ff5252;
}

.trait-tag .remove {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.8;
    margin-left: 4px;
}

.trait-tag .remove:hover {
    opacity: 1;
}

.available-traits {
    max-height: 300px;
    overflow-y: auto;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
}

.trait-item {
    padding: 10px;
    margin: 5px 0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.trait-item:hover {
    background: #f0f0f0;
}

.trait-item.good {
    border-left-color: #4caf50;
}

.trait-item.bad {
    border-left-color: #f44336;
}

.trait-item.mixed {
    border-left-color: #ff9800;
}

.trait-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    gap: 10px;
}

.trait-item-name {
    font-weight: 600;
    flex: 1;
}

.trait-item-buffs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.8em;
}

.trait-item-buff {
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.trait-item-buff.positive {
    background: #ffeb3b;
    color: #333;
}

.trait-item-buff.negative {
    background: #f44336;
    color: white;
}

/* Tier filter buttons */
.tier-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tier-filter-btn {
    padding: 8px 16px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    color: #333;
    transition: all 0.2s ease;
}

.tier-filter-btn:hover {
    background: #e0e0e0;
    border-color: #667eea;
}

.tier-filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Tier badges on trait items */
.trait-tier-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: 600;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trait-tier-badge.tier-top10 {
    background-color: #4caf50; /* Green */
    color: white;
}

.trait-tier-badge.tier-good {
    background-color: #8bc34a; /* Light green */
    color: white;
}

.trait-tier-badge.tier-average {
    background-color: #ffc107; /* Amber */
    color: #333;
}

.trait-tier-badge.tier-bad {
    background-color: #ff9800; /* Orange */
    color: white;
}

.trait-tier-badge.tier-worst10 {
    background-color: #f44336; /* Red */
    color: white;
}

.trait-item-effects {
    font-size: 0.85em;
    color: #666;
}

/* Ensure trait search input is accessible */
#traitSearch {
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
    background: white !important;
}

.equipment-section {
    margin-top: 20px;
}

.equipment-slot {
    margin-bottom: 15px;
}

.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

#previewArea {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

#xmlPreview {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.5;
    max-height: 500px;
    overflow-y: auto;
}

.validation-error {
    color: #dc3545;
    font-size: 0.9em;
    margin-top: 5px;
}

.validation-success {
    color: #28a745;
    font-size: 0.9em;
    margin-top: 5px;
}

.trait-counter {
    margin: 10px 0;
    font-weight: 600;
    color: #667eea;
}

.trait-counter.warning {
    color: #ff9800;
}

.stat-display {
    margin-top: 8px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 0.9em;
}

.stat-base {
    color: #333;
    font-weight: 500;
}

.stat-buff {
    color: #ffd700;
    font-weight: 600;
    margin-left: 4px;
}

.stat-buff.negative {
    color: #ff6b6b;
}

.stat-total {
    color: #666;
    margin-left: 4px;
    font-weight: 500;
}

.trait-counter.error {
    color: #f44336;
}

/* Inventory styles */
.inventory-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.inventory-list {
    margin-top: 20px;
}

.inventory-items-list {
    list-style: none;
    padding: 0;
}

.inventory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
    transition: background 0.2s;
}

.inventory-item:hover {
    background: #e9ecef;
}

.inventory-item.deprecated-item {
    border-left-color: #ff9800;
    background: #fff3e0;
}

.inventory-item.deprecated-item:hover {
    background: #ffe0b2;
}

.item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.item-category {
    color: #666;
    font-size: 0.9em;
}

.item-quantity {
    color: #667eea;
    font-weight: 600;
}

.deprecated-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #ff9800;
    color: white;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-remove-item {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-item:hover {
    background: #c82333;
    transform: scale(1.1);
}

.empty-message {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}
