body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    margin: 0;
    padding: 30px;
}

h1 {
    text-align: center;
    margin-bottom: 25px;
}

.calculator {
    max-width: 1100px;
    margin: 0 auto;
}

.top-section {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.inputs-panel,
.advanced-panel,
.analysis-section {
    background: white;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 18px;
    box-sizing: border-box;
}

.inputs-panel {
    width: 360px;
    flex-shrink: 0;
}

.advanced-panel {
    width: 300px;
    display: none;
}

.advanced-title {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 18px;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 8px;
}

.analysis-section {
    margin-bottom: 20px;
}

.analysis-section h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 20px;
    border-bottom: 1px solid #e5e5e5;
    padding-bottom: 8px;
}

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

label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

input {
    width: 100%;
    padding: 8px 10px;
    font-size: 16px;
    box-sizing: border-box;
    border: 1px solid #bfbfbf;
    border-radius: 6px;
    background: white;
}

#magicInfo {
    margin-top: 6px;
    font-size: 14px;
    color: #666;
}

.primary-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    font-size: 16px;
    font-weight: 600;
    background-color: #3c78ff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.primary-btn:hover {
    background-color: #2e5fd1;
}

.secondary-btn {
    display: inline-block;
    width: auto;
    padding: 8px 14px;
    margin-top: 4px;
    background: white;
    color: #555;
    border: 1px solid #999;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.secondary-btn:hover {
    background: #f2f2f2;
    border-color: #777;
}

#result,
#bestResult,
#comparison,
#itemResult {
    line-height: 1.5;
    white-space: pre-line;
}

.item-container {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.item-card {
    width: 240px;
    border: 1px solid #cfcfcf;
    border-radius: 8px;
    background: #f8f8f8;
    padding: 14px;
    box-sizing: border-box;
}

.item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    min-height: 48px;
}

.item-icon {
    width: 44px;
    height: 44px;
}

.item-name {
    font-weight: bold;
    font-size: 15px;
    line-height: 1.2;
}

.item-stats {
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.4;
}

.item-metrics {
    margin-top: 10px;
    line-height: 1.45;
}

.item-passive {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #999;
    font-size: 13px;
    line-height: 1.4;
}

.item-passive-title {
    font-weight: 700;
    margin-bottom: 4px;
}

.item-passive-text {
    margin-top: 4px;
    font-size: 12px;
    color: #555;
}

@media (max-width: 900px) {
    .top-section {
        flex-direction: column;
    }

    .inputs-panel,
    .advanced-panel {
        width: 100%;
    }

    .secondary-btn {
        width: 100%;
    }
}
#itemScenario {
    margin-bottom: 16px;
}

.scenario-box {
    background: #f8f8f8;
    border: 1px solid #d6d6d6;
    border-radius: 8px;
    padding: 14px 16px;
}

.scenario-title {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 12px;
}

.scenario-top {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #dddddd;
}

.scenario-top-item {
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.scenario-main {
    display: grid;
    grid-template-columns: 1fr 1fr 220px;
    gap: 24px;
    align-items: start;
}

.scenario-group,
.scenario-chart-group {
    background: #fbfbfb;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    padding: 12px 14px;
    min-width: 0;
}

.scenario-group-title {
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 15px;
    color: #333;
}

.scenario-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid #ececec;
}

.scenario-row:last-child {
    border-bottom: none;
}

.scenario-label {
    font-weight: 600;
    color: #333;
}

.scenario-value {
    color: #111;
    text-align: right;
}

.scenario-enemy-row .scenario-label,
.scenario-enemy-row .scenario-value {
    color: #9a4a4a;
}

.scenario-effective-row {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid #d4d4d4;
}

.scenario-effective-row .scenario-label,
.scenario-effective-row .scenario-value {
    font-weight: 700;
}

.scenario-chart-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.damage-pie {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 1px solid #cfcfcf;
    margin-bottom: 12px;
}

.damage-legend {
    width: 100%;
    font-size: 14px;
}

.damage-legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    justify-content: center;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.legend-physical {
    background: #d84a4a;
}

.legend-magic {
    background: #4a78d8;
}

@media (max-width: 900px) {
    .scenario-main {
        grid-template-columns: 1fr;
    }

    .scenario-chart-group {
        align-items: flex-start;
    }

    .damage-legend-row {
        justify-content: flex-start;
    }
}

.passive-inline-row {
    display: flex;
    flex-direction: row;
    gap: 14px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.passive-inline-field {
    display: flex;
    flex-direction: column;
}

.passive-inline-field label {
    font-size: 13px;
    margin-bottom: 3px;
}

.passive-inline-field input {
    width: 80px;
    padding: 4px;
    font-size: 13px;
}