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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        radial-gradient(ellipse at center, rgba(255,255,255,0.3) 0%, transparent 100%),
        linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #dceffa 100%);
    min-height: 100vh;
    padding: 20px;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    padding: 25px 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: rgb(255, 255, 255);
    font-size: 2.5em;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 50);
    margin: 0;
}

/* Section Titles */
.section-title {
    color: white;
    font-size: 1.8em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* Backpack Section */
.backpack-section {
    margin-bottom: 30px;
}

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

.resource-card {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.resource-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.resource-icon {
    font-size: 2.5em;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(145deg, #e0e0e0, #f5f5f5);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.resource-icon img {
    width: 54px;
    height: 54px;
    object-fit: contain;
}

.resource-info {
    flex: 1;
}

.resource-info label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.resource-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    transition: border-color 0.3s;
}

.resource-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Tab Bar */
.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 25px;
    background: linear-gradient(145deg, #e0e0e0, #f0f0f0);
    border-radius: 15px;
    padding: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 1.1em;
    font-weight: 700;
    color: #666;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.5);
    color: #333;
}

.tab-button.active {
    background: linear-gradient(0deg, #ceb083, #a57042);
    border-style: solid;
    border: 3px solid #a57042;
    color: rgb(0, 0, 0);
}

/* Tab Panels */
.tab-panel {
    display: none;
}

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

/* Gear Cards Section */
.gears-section {
    margin-bottom: 30px;
}

.gear-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.gear-card {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 3px solid transparent;
}

.gear-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    border-color: #a57042;
}

.gear-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.gear-icon {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: linear-gradient(145deg, #ffffff, #ffffff);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    overflow: hidden;
}

.gear-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gear-name {
    font-size: 1.5em;
    color: #333;
    font-weight: 700;
}

.gear-inputs {
    margin-bottom: 20px;
}

.mastery-warning {
    background: linear-gradient(145deg, #ffebee, #ffcdd2);
    border-left: 4px solid #f44336;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.mastery-warning .warning-text {
    color: #c62828;
    font-size: 0.9em;
    font-weight: 600;
    display: block;
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    font-size: 1.05em;
    color: #4e4e4e;
    margin-bottom: 8px;
    font-weight: 700;
}

.range-inputs {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.input-label {
    font-size: 0.8em;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.range-inputs input,
.range-inputs select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.3s;
    cursor: pointer;
}

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

/* Keep level selects white when focused/opened */
.range-inputs select.level-from:focus,
.range-inputs select.level-to:focus {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Level transformation backgrounds */
.level-from.level-101-119,
.level-to.level-101-119 {
    background: linear-gradient(145deg, #e2e2e2, #e2e2e2);
    transition: background 0.2s, transform 0.2s;
    color: #000000 !important;
    font-weight: 700 !important;
    font-weight: 700;
    font-size: 1.055em;
}

.level-from.level-120-139,
.level-to.level-120-139 {
    background: linear-gradient(145deg, #a6f7a8, #a6f7a8);
    transition: background 0.2s, transform 0.2s;
    color: #000000 !important;
    font-weight: 700 !important;
    font-size: 1.055em;
}

.level-from.level-140-159,
.level-to.level-140-159 {
    background: linear-gradient(145deg, #9cc1df, #9cc1df);
    transition: background 0.2s, transform 0.2s;
    color: #000000 !important;
    font-weight: 700 !important;
    font-size: 1.055em;
}

.level-from.level-160-179,
.level-to.level-160-179 {
    background: linear-gradient(145deg, #d099da, #d099da);
    transition: background 0.2s, transform 0.2s;
    color: #000000 !important;
    font-weight: 700 !important;
    font-size: 1.055em;
}

.level-from.level-180-199,
.level-to.level-180-199 {
    background: linear-gradient(145deg, #d1ad78, #d1ad78);
    transition: background 0.2s, transform 0.2s;
    color: #000000 !important;
    font-weight: 700 !important;
    font-size: 1.055em;
}

.level-from.level-200,
.level-to.level-200 {
    background: linear-gradient(145deg, #f5766c, #f5766c);
    transition: background 0.2s, transform 0.2s;
    color: #000000 !important;
    font-weight: 700 !important;
    font-size: 1.055em;
}

.range-inputs .arrow {
    color: #667eea;
    font-weight: bold;
    font-size: 1em;
    text-align: center;
    display: none;
}

.gear-stats {
    margin-bottom: 20px;
}

.stat-badge {
    background: linear-gradient(145deg, #e8f4f8, #dbeafe);
    padding: 15px;
    border-radius: 12px;
    border-left: 4px solid #3b82f6;
}

/* Gear Bonuses Section */
.gear-bonuses {
    margin-bottom: 20px;
}

.bonus-label {
    font-size: 0.85em;
    color: #666;
    font-weight: 600;
    margin-bottom: 10px;
}

.bonus-items {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bonus-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-bottom: 2px solid #d0d0d0;
    transition: background 0.2s, transform 0.2s;
}

.bonus-item:last-child {
    border-bottom: none;
}

.bonus-item:hover {
    background: linear-gradient(145deg, #e9ecef, #dee2e6);
    transform: translateX(5px);
    z-index: 1;
}

.bonus-item.unlocked {
    background: linear-gradient(145deg, #d4edda, #c3e6cb);
    border-left: 4px solid #28a745;
    padding-left: 11px;
}

.bonus-item.unlocked:hover {
    background: linear-gradient(145deg, #c3e6cb, #b1dfbb);
}

.bonus-level {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 700;
    color: #ffffff;
    min-width: 50px;
    text-align: center;
}

.bonus-item[data-level="120"] .bonus-level {
    background-color: #4caf50;
}

.bonus-item[data-level="140"] .bonus-level {
    background-color: #2196f3;
}

.bonus-item[data-level="160"] .bonus-level {
    background-color: #9c27b0;
}

.bonus-item[data-level="180"] .bonus-level {
    background-color: #ff9800;
}

.bonus-item[data-level="200"] .bonus-level {
    background-color: #f44336;
}

.bonus-text {
    font-size: 0.85em;
    font-weight: 500;
    color: #555;
    flex: 1;
}

.bonus-value {
    font-size: 0.85em;
    font-weight: 700;
    color: #000000;
    min-width: 60px;
    text-align: right;
}

.stat-label {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 5px;
    font-weight: 600;
}

.stat-increase {
    display: inline-block;
    background: #109e6f;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 700;
    margin-top: 5px;
}

.gear-costs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.cost-item {
    background-color:rgba(255, 255, 255, 0);
    padding: 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.cost-icon {
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cost-icon img {
    width: 41px;
    height: 41px;
    object-fit: contain;
}

.cost-value {
    color: #333;
    font-size: 1em;
}

/* Summary Section */
.summary-section {
    margin-bottom: 30px;
}

.summary-table-wrapper {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow-x: auto;
}

.summary-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 2px;
    overflow: hidden;
}

.summary-table th {
    padding: 15px;
    text-align: left;
    font-size: 1em;
    font-weight: 700;
    color: rgb(0, 0, 0);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(0deg, #ceb083, #a57042);
    border-top: 3px solid #a57042;
    border-bottom: 3px solid #a57042;
}

.summary-table th:first-child {
    border-left: 3px solid #8a5c2a;
    border-radius: 15px 0 0 15px;
}

.summary-table th:last-child {
    border-right: 3px solid #8a5c2a;
    border-radius: 0 15px 15px 0;
}

.summary-table th:first-child {
    width: 60px;
    text-align: center;
}

.summary-table th:nth-child(3),
.summary-table th:nth-child(4),
.summary-table th:nth-child(5) {
    text-align: center;
}

.summary-table tbody tr {
    transition: background 0.2s;
}

.summary-table tbody tr td {
    border-bottom: 2px solid #e0e0e0;
}

.summary-table tbody tr:last-child td {
    border-bottom: none;
}

.summary-table tbody tr:hover {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
}

.summary-table td {
    padding: 15px;
    font-size: 1em;
    color: #333;
}

.table-icon {
    text-align: center;
    width: 60px;
}

.table-icon img {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.table-item-name {
    font-weight: 600;
    color: #333;
}

.table-backpack,
.table-total-cost,
.table-remaining {
    font-weight: 700;
    font-size: 1.1em;
    text-align: center;
}

.table-backpack {
    color: #3b82f6;
}

.table-total-cost {
    color: #ef4444;
}

.table-remaining.positive {
    color: #0c865e;
}

.table-remaining.negative {
    color: #ef4444;
}

.table-remaining.zero {
    color: #333;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 1em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .gear-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Tablet and Mobile Devices */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    .tab-button {
        padding: 10px 12px;
        font-size: 0.95em;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 20px;
    }

    .header h1 {
        font-size: 2em;
    }

    .section-title {
        font-size: 1.5em;
    }

    /* Backpack grid - 2 columns on tablet */
    .backpack-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    /* Gear cards - single column */
    .gear-cards-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Adjust gear card padding */
    .gear-card {
        padding: 20px;
    }

    /* Make inputs touch-friendly */
    .resource-input,
    .range-inputs select {
        min-height: 44px;
        font-size: 16px;
    }

    /* Adjust bonus items */
    .bonus-item {
        padding: 10px;
    }
}

/* Mobile Phones (iPhone, Samsung Galaxy, etc.) */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 10px;
    }

    .tab-bar {
        border-radius: 10px;
        padding: 3px;
    }

    .tab-button {
        padding: 10px 8px;
        font-size: 0.85em;
        border-radius: 8px;
    }

    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .section-title {
        font-size: 1.3em;
    }

    /* Backpack grid - single column on small phones */
    .backpack-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .resource-card {
        padding: 12px;
    }

    /* Gear icon size */
    .gear-icon {
        width: 50px;
        height: 50px;
    }

    .gear-icon img {
        width: 100%;
        height: 100%;
    }

    .gear-name {
        font-size: 1.2em;
    }

    /* Input groups */
    .input-group {
        margin-bottom: 12px;
    }

    .input-group label {
        font-size: 1em;
        margin-bottom: 6px;
    }

    /* Range inputs - stack vertically on very small screens */
    .range-inputs {
        flex-direction: column;
        gap: 8px;
    }

    .input-wrapper {
        width: 100%;
    }

    /* Touch-friendly inputs */
    .resource-input,
    .range-inputs select {
        min-height: 48px;
        font-size: 16px;
        padding: 10px;
    }

    /* Summary table - responsive on mobile */
    .summary-table-wrapper {
        padding: 15px;
    }

    .summary-table th,
    .summary-table td {
        padding: 8px 5px;
        font-size: 0.8em;
    }

    .table-icon {
        width: 40px;
    }

    .table-icon img {
        width: 28px;
        height: 28px;
    }

    .table-item-name {
        font-size: 0.75em;
    }

    .table-backpack,
    .table-total-cost,
    .table-remaining {
        font-size: 0.85em;
    }

    /* Bonus items */
    .bonus-item {
        padding: 8px;
        font-size: 0.85em;
    }

    .bonus-level {
        font-size: 0.75em;
        min-width: 35px;
        height: 35px;
    }

    .bonus-value {
        font-size: 0.85em;
    }

    /* Stats */
    .stat-badge {
        padding: 12px;
    }

    .stat-label {
        font-size: 0.9em;
    }

    .stat-value {
        font-size: 1em;
    }

    /* Mastery warning */
    .mastery-warning {
        padding: 10px 12px;
    }

    .mastery-warning .warning-text {
        font-size: 0.85em;
    }

    /* Footer */
    footer {
        padding: 15px;
        font-size: 0.9em;
    }
}

/* Extra small phones */
@media (max-width: 360px) {
    .header h1 {
        font-size: 1.3em;
    }

    .section-title {
        font-size: 1.1em;
    }

    .gear-card {
        padding: 15px;
    }

    .summary-table-wrapper {
        padding: 10px;
    }

    .summary-table th,
    .summary-table td {
        padding: 6px 3px;
        font-size: 0.7em;
    }

    .table-icon {
        width: 35px;
    }

    .table-icon img {
        width: 24px;
        height: 24px;
    }

    .table-item-name {
        font-size: 0.7em;
    }

    .table-backpack,
    .table-total-cost,
    .table-remaining {
        font-size: 0.75em;
    }
}
