:root {
    --bg-dark: #0f1115;
    --bg-panel: rgba(26, 29, 36, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f0f2f5;
    --text-secondary: #a0a5b0;
    --accent: #e2b714;
    --accent-hover: #ffcf1a;
    --glass-blur: blur(12px);
    --glow: 0 0 20px rgba(226, 183, 20, 0.15);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(226, 183, 20, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(50, 100, 200, 0.05) 0%, transparent 50%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.app-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

header {
    text-align: center;
    margin-bottom: 1rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #fff 0%, #a0a5b0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--accent);
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
}

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    animation: fadeInUp 0.8s ease-out;
}

.panel {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.panel:hover {
    box-shadow: var(--glow);
    border-color: rgba(255, 255, 255, 0.2);
}

#results-panel {
    grid-column: 1 / -1;
    background: linear-gradient(180deg, rgba(26, 29, 36, 0.8) 0%, rgba(20, 22, 28, 0.9) 100%);
    border-top: 2px solid var(--accent);
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

input,
select {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(226, 183, 20, 0.2);
}

.result-card {
    text-align: center;
}

#res-ability-name {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.highlight {
    color: var(--accent);
    font-size: 1.8rem;
    text-shadow: 0 0 15px rgba(226, 183, 20, 0.4);
}

.ability-details {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    text-align: left;
}

.desc-text {
    margin-top: 0.5rem;
    font-style: italic;
    color: #c0c5d0;
}

footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2rem;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 600px) {
    main {
        grid-template-columns: 1fr;
    }

    .metrics {
        grid-template-columns: 1fr;
    }
}

.btn-primary {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(226, 183, 20, 0.3);
}

/* Slot Wrapper & Ability Icon */
.slot-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.slot-label {
    font-size: 0.7rem;
    color: #ffd700;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 0 2px rgba(255, 215, 0, 0.3);
}

.slot-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.slot-icon-box.has-icon {
    border-color: rgba(226, 183, 20, 0.4);
    box-shadow: 0 0 10px rgba(226, 183, 20, 0.15);
}

.slot-icon-box img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    image-rendering: pixelated;
}

.slot-icon-placeholder {
    width: 28px;
    height: 28px;
    opacity: 0.15;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E") center/contain no-repeat;
}

.slot-icon-loading {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(226, 183, 20, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Make ability selects full-width in their wrappers */
.slot-wrapper select {
    width: 100%;
    font-size: 0.8rem;
    padding: 0.4rem 0.5rem;
}

/* Search inputs for ability/passive dropdowns */
.ability-search-input {
    width: 100%;
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
}

.ability-search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Custom dropdown with icons */
.ability-dropdown-display {
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
}

.ability-dropdown-list {
    width: 100%;
    max-height: 220px;
    margin-top: 0.25rem;
    border-radius: 6px;
    background: rgba(5, 5, 8, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    overflow-y: auto;
    display: none;
    z-index: 20;
}

.ability-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.ability-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.ability-dropdown-item img,
.ability-dropdown-item-noicon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
    image-rendering: pixelated;
    background: rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.ability-dropdown-item span {
    flex: 1;
}

/* Cast order inputs for active abilities */
.slot-order-input {
    width: 2.5rem;
    font-size: 0.8rem;
    padding: 0.2rem 0.3rem;
    margin-top: 0.15rem;
    text-align: center;
    background: rgba(255, 200, 100, 0.25);
    border: 2px solid #ffd700;
    color: #ffd700;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: 0 0 4px rgba(255, 215, 0, 0.3);
}
.slot-order-input:focus {
    outline: none;
    border-color: #ffea00;
    background: rgba(255, 200, 100, 0.35);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
}

/* Min Resources inputs */
.slot-min-res-label {
    font-size: 0.6rem;
    color: var(--text-secondary);
    margin-left: 0.3rem;
    margin-top: 0.15rem;
}
.slot-min-resources-input {
    width: 1.8rem;
    font-size: 0.7rem;
    padding: 0.15rem 0.2rem;
    margin-top: 0.15rem;
    text-align: center;
    background: rgba(100, 200, 255, 0.1);
    border: 1px solid rgba(100, 200, 255, 0.3);
    color: #66d9ff;
    border-radius: 4px;
}
.slot-min-resources-input:focus {
    outline: none;
    border-color: #66d9ff;
    background: rgba(100, 200, 255, 0.2);
}

/* Slot breakdown rows in results */
.breakdown-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.3);
}

/* Augment selection styling */
.augment-wrapper {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.augment-wrapper:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.augment-ability-name {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.augment-select {
    width: 100%;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.augment-select:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 8px rgba(226, 183, 20, 0.2);
}

.augment-select option {
    background: var(--bg-dark);
    color: var(--text-primary);
    padding: 0.25rem;
}

.augment-select optgroup {
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
}