/* Reorganized from latest source with safe deduplication focus.
   Goal:
   - keep current visual layout
   - remove obvious duplicate blocks
   - preserve equip/result icon sizing
   - keep final button behavior stable
*/

/* ------------------------------
   Base layout
------------------------------ */
.build-editor-page {
    overflow: visible;
}

.build-editor-header {
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.16), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, #f1f5fb 100%);
}

.build-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 18px;
    align-items: start;
    padding: 18px;
}

.build-editor-layout:has(.build-editor-side.is-overlay-mode) {
    grid-template-columns: minmax(0, 1fr) 12px;
}

.build-editor-layout.is-side-collapsed {
    grid-template-columns: minmax(0, 1fr) 12px;
}

.build-editor-main {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(320px, 1fr);
    gap: 18px;
    min-width: 0;
}

.build-editor-side {
    position: relative;
    min-width: 0;
}

.build-editor-side__handle {
    position: absolute;
    top: 14px;
    left: -12px;
    width: 12px;
    min-height: 120px;
    padding: 10px 0;
    border: 1px solid #cfd8e3;
    border-right: none;
    border-radius: 12px 0 0 12px;
    background: linear-gradient(180deg, #ffffff 0%, #eef3f8 100%);
    color: #64748b;
    cursor: pointer;
    z-index: 5;
    box-shadow: -2px 8px 18px rgba(15, 23, 42, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.build-editor-side__handle:hover {
    background: #e9f2ff;
    color: #2563eb;
}

.build-editor-side__handle:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 2px;
}

.build-editor-side__handle-icon {
    font-size: 10px;
    line-height: 1;
    transform: rotate(180deg);
}

.build-editor-side__handle-text {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.build-editor-side__backdrop {
    display: none;
}

.build-editor-side__panel {
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.build-editor-side.is-collapsed .build-editor-side__panel {
    opacity: 0;
    pointer-events: none;
    transform: translateX(8px);
}

.build-editor-side.is-collapsed .build-editor-side__handle-icon {
    transform: rotate(0deg);
}

.build-panel {
    display: grid;
    gap: 16px;
    align-content: start;
}

.build-section {
    padding: 16px;
    border: 1px solid #dde5ef;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafd 100%);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.build-section__head {
    margin-bottom: 14px;
}

.build-section__head--between {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.build-section__head h3 {
    margin: 0;
    font-size: 18px;
}

.build-section__sub {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.6;
}

.build-section__desc {
    margin: 4px 0 0;
    font-size: 11px;
    color: #999;
}

.build-editor-side .build-section + .build-section {
    margin-top: 16px;
}

/* ------------------------------
   Action buttons
------------------------------ */
.build-inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    align-items: center;
}

.edit-btn.is-small {
    min-height: 36px;
    padding-inline: 12px;
}

.build-effect-chart-btn {
    min-width: 36px;
    width: 36px;
    height: 36px;
    padding: 6px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.build-effect-chart-btn__icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

.build-effect-chart-btn.is-disabled,
.build-effect-chart-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .build-effect-chart-btn {
        min-width: 32px;
        width: 32px;
        height: 32px;
        padding: 5px;
        border-radius: 9px;
    }

    .build-effect-chart-btn__icon {
        width: 16px;
        height: 16px;
    }
}

#buildFavoriteButton,
#buildSaveButton,
#buildRecalculateButton,
#buildScreenshotButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-width: 96px;
    min-height: 40px;
    padding: 10px 18px;
    border-radius: 12px;
    flex: 0 0 auto;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    position: relative;
    overflow: hidden;
}

#buildFavoriteButton::before,
#buildSaveButton::before,
#buildRecalculateButton::before,
#buildScreenshotButton::before {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    height: 1em;
    margin-right: 6px;
    font-size: 14px;
    line-height: 1;
    flex: 0 0 auto;
}

#buildFavoriteButton::before { content: "★"; }
#buildSaveButton::before { content: "💾"; }
#buildRecalculateButton::before { content: "↻"; font-weight: 700; }

#buildFavoriteButton {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: 1px solid #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    font-weight: 700;
    font-size: 14px;
    transition: all 0.15s ease;
}

#buildFavoriteButton:hover {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

#buildFavoriteButton:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

#buildFavoriteButton.is-added {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    border-color: #b45309;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.30);
}

#buildFavoriteButton.is-added:hover {
    background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.36);
}

#buildFavoriteButton:disabled {
    background: #f8fafc;
    color: #94a3b8;
    border-color: #e2e8f0;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
}

#buildSaveButton {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
    border: 1px solid #15803d;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
    font-weight: 700;
    font-size: 14px;
    transition: all 0.15s ease;
}

#buildSaveButton:hover {
    background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.35);
    transform: translateY(-1px);
}

#buildSaveButton:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

#buildSaveButton.unsaved {
    background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
    border-color: #b45309;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

#buildRecalculateButton {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s ease;
}

#buildRecalculateButton:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

#buildScreenshotButton {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s ease;
}

#buildScreenshotButton:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

#buildFavoriteButton:focus-visible,
#buildSaveButton:focus-visible,
#buildRecalculateButton:focus-visible,
#buildScreenshotButton:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3);
}

/* ------------------------------
   Weapon type
------------------------------ */
.weapon-type-box {
    margin-bottom: 10px;
    padding: 10px 10px 8px;
    border: 1px solid #d8e2ee;
    border-radius: 14px;
    background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

.weapon-type-box__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.weapon-type-box__title {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    line-height: 1.2;
}

.weapon-type-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px 6px;
}

.weapon-type-chip {
    display: grid;
    place-items: center;
    width: 100%;
    height: 36px;
    min-height: 36px;
    padding: 0;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    box-sizing: border-box;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.weapon-type-chip:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.9);
    border-color: #cfe0f7;
}

.weapon-type-chip.is-active {
    transform: translateY(-1px);
    background: #eff6ff;
    border-color: #60a5fa;
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.18);
}

.weapon-type-chip__icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
    padding: 0;
    margin: 0;
}

.weapon-type-chip:hover .weapon-type-chip__icon {
    border-color: rgba(96, 165, 250, 0.55);
}

.weapon-type-chip.is-active .weapon-type-chip__icon {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* ------------------------------
   Slot cards
------------------------------ */
.build-slot-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    border-radius: 0;
    background: #ffffff;
}

.build-slot-card {
    display: block;
    width: 100%;
    min-height: 92px;
    padding: 0;
    border: 0;
    border-top: 1px solid #cbd5e1;
    border-radius: 0;
    background: #ffffff;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    box-sizing: border-box;
}

.build-slot-card:first-child {
    border-top: 0;
}

.build-slot-card:hover {
    box-shadow: inset 0 0 0 2px rgba(96, 165, 250, 0.28);
}

.build-slot-card.is-filled {
    background: #ffffff;
}

.build-slot-card.is-locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.build-slot-card.is-locked:hover {
    transform: none;
    box-shadow: none;
}

.build-slot-card__label {
    display: block;
    padding: 8px 12px 0;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    color: #64748b;
    letter-spacing: 0.02em;
}

.build-slot-card__value {
    display: block;
    width: 100%;
    min-height: 92px;
}

.build-slot-card__empty {
    display: grid;
    place-items: center;
    min-height: 92px;
}

.build-slot-card__placeholder-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    opacity: 0.9;
}

.build-slot-card .equip-card--compact {
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    box-sizing: border-box;
    box-shadow: none;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.build-slot-card .equip-card__head,
.build-slot-card .equip-card__body {
    display: block;
    width: 100%;
}

.build-slot-card .equip-card--compact,
.build-slot-card .equip-card__title-row,
.build-slot-card .equip-name,
.build-slot-card .equip-stats,
.build-slot-card .equip-skill-title {
    min-width: 0;
}

.build-slot-card .equip-card__head {
    margin-bottom: 6px;
}

.build-slot-card .equip-card__body {
    margin: 0;
}

.build-slot-card .equip-card__title-row {
    align-items: flex-start;
}

.build-slot-card .equip-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    line-height: 1.3;
}

.build-slot-card .equip-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 4px;
}

.build-slot-card .equip-stat {
    font-size: 11px;
}

.build-slot-card .equip-stat span {
    font-size: 12px;
}

.build-slot-card .equip-skills {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}

.build-slot-card .equip-skill-card {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    box-sizing: border-box;
}

.build-slot-card .equip-skill-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.build-slot-card .equip-skill-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
    line-height: 1.35;
    word-break: break-word;
}

.build-slot-card .equip-skill-lv {
    flex: 0 0 auto;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

.build-slot-card .equip-skill-bars {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
}

/* ------------------------------
   Mini skill rows
------------------------------ */
.build-skill-mini {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 8px;
}

.build-skill-mini__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 6px;
    align-items: center;
    padding: 4px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    min-width: 0;
}

.build-skill-mini__name {
    min-width: 0;
    font-size: 11px;
    color: #475569;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.build-skill-mini__level {
    font-size: 11px;
    font-weight: 800;
    color: #2563eb;
    white-space: nowrap;
}

.build-skill-mini__bar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
}

.build-skill-mini__dot {
    height: 4px;
    border-radius: 999px;
    background: #d7dee8;
}

.build-skill-mini__dot.is-on {
    background: #22c55e;
}

/* ------------------------------
   Drift section
------------------------------ */
.drift-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.drift-summary__item {
    padding: 10px 12px;
    border: 1px solid #dbe2ea;
    border-radius: 12px;
    background: #f8fafc;
    text-align: center;
}

.drift-summary__item span {
    display: block;
    color: #64748b;
    font-size: 11px;
}

.drift-summary__item strong {
    display: block;
    margin-top: 4px;
    font-size: 18px;
}

.drift-summary__item.is-over strong,
.drift-summary__item.is-over span {
    color: #dc2626;
}

.drift-empty,
.build-modal__placeholder {
    padding: 16px;
    border: 1px dashed #cbd5e1;
    border-radius: 14px;
    background: #f8fafc;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.7;
}

.build-drift-box {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid #d7e3f1;
    border-radius: 14px;
    background: linear-gradient(180deg, #f6faff 0%, #eef4fb 100%);
}

.build-drift-box__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.build-drift-box__title-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.build-drift-box__title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}

.build-drift-box__meta {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    white-space: nowrap;
}

.build-drift-box__meta strong,
.build-drift-box__meta span {
    font-size: 14px;
}

.build-drift-box__meta.is-over {
    color: #dc2626;
}

.build-drift-box__desc {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: #64748b;
}

.build-drift-box__add-btn {
    appearance: none;
    border: 1px solid #bfdbfe;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    color: #1d4ed8;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.build-drift-box__add-btn:hover {
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.16);
}

.build-drift-box__add-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22);
}

.drift-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.drift-skill-card {
    display: block;
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: #f8fafc;
    box-sizing: border-box;
}

.drift-skill-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.drift-skill-card__title-wrap {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.drift-skill-card__name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-main);
    word-break: break-word;
}

.drift-skill-card__level {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    flex-shrink: 0;
}

.drift-skill-card__stepper {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.drift-level-stepper-btn {
    width: 16px;
    height: 16px;
    min-width: 16px;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    font-size: 9px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.drift-level-stepper-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.drift-level-stepper-btn:disabled {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: default;
}

.drift-skill-card__remove {
    width: 18px;
    height: 18px;
    min-width: 18px;
    padding: 0;
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: #fff5f5;
    color: #dc2626;
    font-size: 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.drift-skill-card__remove:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

.drift-skill-card__bars {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
}

.drift-skill-bar {
    display: block;
    height: 2px;
    border: 0;
    padding: 0;
    border-radius: 999px;
    background: #d1d5db;
    cursor: pointer;
}

.drift-skill-bar.is-active {
    background: #facc15;
}

.drift-picker-results,
.drift-picker-list {
    display: grid;
    gap: 10px;
}

.drift-picker-list {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.drift-picker-item {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 7px;
    background: #f8fafc;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}

.drift-picker-item:hover {
    background: #ffffff;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12);
    transform: translateY(-1px);
}

.drift-picker-item__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}

.drift-picker-item__title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.35;
    word-break: break-word;
}

.drift-picker-item__bars {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
}

/* ------------------------------
   Activation / params
------------------------------ */
.activation-table {
    display: grid;
    gap: 0;
}

.activation-groups {
    display: grid;
    gap: 14px;
}

.activation-group {
    border: 1px solid #dbe2ea;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.activation-group__heading {
    margin: 0;
}

.activation-group__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    cursor: pointer;
    text-align: left;
}

.activation-group__toggle:hover {
    background: #f8fbff;
}

.activation-group__toggle:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: -2px;
}

.activation-group__title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.activation-group__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.activation-group__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.activation-group__chevron {
    font-size: 12px;
    color: #64748b;
    transition: transform 0.18s ease;
}

.activation-group.is-collapsed .activation-group__chevron {
    transform: rotate(-90deg);
}

.activation-group__body {
    padding: 0 12px 10px;
    border-top: 1px solid #eef2f7;
}

.activation-group.is-collapsed .activation-group__body {
    display: none;
}

.activation-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px 14px;
    gap: 2px;
    align-items: center;
    min-height: 28px;
    padding: 1px 0;
    border-bottom: 1px solid #eef2f7;
}

.activation-row:last-child {
    border-bottom: 0;
}

.activation-row__label {
    min-width: 0;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    color: #334155;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activation-row__input {
    width: 30px;
    min-width: 30px;
    height: 22px;
    padding: 1px 4px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    text-align: right;
    box-sizing: border-box;
    justify-self: end;
    appearance: textfield;
    -moz-appearance: textfield;
    transition: all 0.15s ease;
}

.activation-row__input::-webkit-outer-spin-button,
.activation-row__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.activation-row__input:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.activation-row__input:focus {
    outline: none;
    background: #eff6ff;
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.25);
}

.activation-row__suffix {
    font-size: 12px;
    line-height: 1;
    margin-left: -2px;
    color: #475569;
    text-align: left;
}

.custom-param-sections {
    display: grid;
    gap: 14px;
}

.custom-param-group {
    display: grid;
    gap: 10px;
}

.custom-param-grid {
    display: grid;
    gap: 8px 10px;
}

.custom-param-grid--basic {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.custom-param-grid--bowgun {
    grid-template-columns: 1fr;
    margin-top: 6px;
}

.activation-row--custom-field {
    grid-template-columns: minmax(0, 1fr) 58px 14px;
    padding: 2px 0;
    border-bottom: 0;
}

.custom-bowgun-mode {
    display: grid;
    gap: 8px;
}

.custom-select-field {
    display: block;
}

.custom-bowgun-mode-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 10px;
    align-items: center;
}

.custom-bowgun-mode-head__title {
    margin: 0;
}

.custom-select-field--inline {
    display: block;
    margin: 0;
}

.custom-select-field__select {
    width: 100%;
    min-height: 36px;
    max-width: 190px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #0f172a;
    font-size: 13px;
    font-weight: 600;
    box-sizing: border-box;
}

.custom-select-field__select:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.custom-select-field__select:focus {
    outline: none;
    background: #eff6ff;
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(147, 197, 253, 0.25);
}

.custom-param-group .activation-row--select {
    display: grid;
    grid-template-columns: 1fr minmax(150px, 220px);
    gap: 12px;
    align-items: center;
}

.custom-param-group .activation-row--select .activation-row__label {
    min-width: 0;
    white-space: nowrap;
}

.custom-param-group .activation-row--select .activation-row__select {
    width: 100%;
    min-width: 150px;
    max-width: 220px;
    justify-self: start;
}

.custom-param-group .activation-row--select-only {
    display: block;
}

.custom-param-group .activation-row--select-only .activation-row__select {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 280px;
}

/* bowgun select enhancement */
.custom-param-group .activation-row__select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 8px 36px 8px 12px;
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid #ccc;
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20'%3E%3Cpath fill='%23666' d='M5 7l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.custom-param-group .activation-row__select:hover {
    border-color: #888;
    background-color: #fafafa;
}

.custom-param-group .activation-row__select:focus {
    outline: none;
    border-color: #4da3ff;
    box-shadow: 0 0 0 2px rgba(77, 163, 255, 0.2);
}

.custom-param-group .activation-row__select:active {
    transform: translateY(1px);
}

/* ------------------------------
   Modal / picker
------------------------------ */
.build-modal[hidden] {
    display: none;
}

.build-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
}

.build-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
}

.build-modal__dialog {
    position: relative;
    width: min(1040px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    margin: 24px auto;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.build-modal__dialog--narrow {
    width: min(640px, calc(100vw - 32px));
}

.build-modal__header,
.build-modal__body {
    padding: 18px;
}

.build-modal__header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.build-modal__header h3 {
    margin: 0 0 6px;
}

.build-modal__header p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
}

.build-modal__close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: #e2e8f0;
    cursor: pointer;
}

.build-modal__body {
    display: grid;
    gap: 14px;
    min-height: 0;
    overflow: auto;
}

.build-modal__results {
    min-height: 220px;
}

.build-modal__toolbar {
    display: grid;
    gap: 12px;
}

.build-modal__search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #cfd8e3;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.build-modal__search-wrap:hover {
    border-color: #93c5fd;
    background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
}

.build-modal__search-wrap:focus-within {
    border-color: #60a5fa;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

.build-modal__search-icon {
    flex: 0 0 auto;
    font-size: 14px;
    line-height: 1;
    opacity: 0.7;
}

.build-modal__search--equip {
    width: 100%;
    min-height: 38px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 14px;
    color: #0f172a;
}

.build-modal__search--equip:focus {
    outline: none;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.build-modal__search--equip::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.equip-picker-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.equip-picker-toolbar__search {
    flex: 0 1 520px;
    min-width: 280px;
}

.equip-picker-toolbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.equip-picker-toolbar__clear {
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.08s ease;
}

.equip-picker-toolbar__clear:hover {
    border-color: #93c5fd;
    background: linear-gradient(180deg, #ffffff 0%, #f1f7ff 100%);
}

.equip-picker-toolbar__clear:focus-visible {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

.equip-picker-toolbar__clear:active {
    transform: translateY(1px);
}

.equip-picker-toolbar__keep {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.equip-picker-toolbar__keep input[type="checkbox"] {
    margin: 0;
    accent-color: #3b82f6;
}

.equip-picker-series {
    margin-bottom: 14px;
}

.equip-picker-series__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.equip-picker-series__item {
    width: 44px;
    height: 44px;
    padding: 6px;
    border: 1px solid #d7dde6;
    border-radius: 10px;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.equip-picker-series__item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
    border-color: #94a3b8;
}

.equip-picker-series__item.is-active {
    border-color: #2563eb;
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.equip-picker-series__item.is-active:hover {
    border-color: #1d4ed8;
    background: #dbeafe;
}

.equip-picker-series__icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.equip-picker-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 320px));
    gap: 12px;
    justify-content: start;
    align-items: start;
}

.equip-picker-card {
    display: block;
    width: 320px;
    max-width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
}

.equip-picker-card .equip-card--compact {
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.equip-picker-card:hover .equip-card--compact,
.equip-picker-card:focus-visible .equip-card--compact {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
    transform: translateY(-1px);
}

.equip-picker-card:focus-visible {
    outline: none;
}

/* ------------------------------
   Result area
------------------------------ */
.build-result-visual {
    display: grid;
    gap: 16px;
}

.result-visual-section {
    display: grid;
    gap: 10px;
}

.result-visual-section__title {
    margin: 0;
    font-size: 14px;
    color: #334155;
}

.result-visual-grid {
    display: grid;
    gap: 12px;
}

.result-visual-grid--two {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
}

.result-visual-card {
    padding: 14px;
    border: 1px solid #dbe2ea;
    border-radius: 14px;
    background: #fff;
    min-width: 0;
}

.result-visual-card__title {
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
}

.result-visual-card__title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.result-visual-card__title-row .result-visual-card__title {
    margin-bottom: 0;
}

.result-visual-card__meta {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    white-space: nowrap;
}

.result-visual-card__meta strong,
.result-visual-card__meta span {
    color: inherit;
}

.result-visual-card__meta.is-over {
    color: #dc2626;
}

.result-empty {
    padding: 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    color: #94a3b8;
    font-size: 12px;
}

.result-equip-list {
    display: grid;
    gap: 8px;
}

.result-equip-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.result-equip-row.is-empty {
    background: #fcfcfd;
}

.result-equip-row.is-filled {
    grid-template-columns: 1fr;
}

.result-equip-row.is-filled .result-equip-row__label {
    display: none;
}

.result-equip-row__label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.result-equip-row__main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.result-equip-row__icons {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.result-equip-row__icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.result-equip-row__name {
    min-width: 0;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
}

.result-equip-row__empty {
    font-size: 12px;
    color: #94a3b8;
}

.result-top-summary {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 12px;
    align-items: stretch;
}

.result-top-summary__card {
    padding: 14px 16px;
    border: 1px solid #dbe2ea;
    border-radius: 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    min-width: 0;
}

.result-top-summary__card--expected {
    grid-column: 1;
    grid-row: 1 / span 2;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
    border-color: #bfdbfe;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.result-top-summary__card--metrics-compact {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-content: center;
}

.result-top-summary__card--weapon-special {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    gap: 8px;
    align-content: start;
}

.result-top-summary__label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 6px;
    line-height: 1.2;
}

.result-top-summary__value {
    font-size: 28px;
    line-height: 1.1;
    font-weight: 800;
    color: #0f172a;
}

.result-top-summary__expected-stack {
    display: grid;
    gap: 8px;
    margin-top: 2px;
}

.result-top-summary__expected-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    padding: 6px 0;
}

.result-top-summary__expected-row + .result-top-summary__expected-row {
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.result-top-summary__expected-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    flex: 0 0 auto;
}

.result-top-summary__expected-badge--normal {
    background: #e2e8f0;
    color: #334155;
}

.result-top-summary__expected-badge--boosted {
    background: #dbeafe;
    color: #1d4ed8;
}

.result-top-summary__expected-value {
    font-size: 22px;
    line-height: 1.1;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    text-align: right;
    flex: 1 1 auto;
}

.result-top-summary__stat-row {
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 4px 0;
}

.result-top-summary__stat-main {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: nowrap;
}

.result-top-summary__stat-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    object-fit: contain;
}

.result-top-summary__stat-value {
    font-size: 15px;
    line-height: 1;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
}

.result-top-summary__stat-meta {
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
}

@media (max-width: 1200px) {
    .result-top-summary {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .result-top-summary__card--expected,
    .result-top-summary__card--metrics-compact,
    .result-top-summary__card--weapon-special {
        grid-column: auto;
        grid-row: auto;
    }

    .result-top-summary__card--metrics-compact {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .result-top-summary__stat-main {
        gap: 4px;
    }

    .result-top-summary__stat-icon {
        width: 13px;
        height: 13px;
        flex: 0 0 13px;
    }

    .result-top-summary__stat-value {
        font-size: 13px;
    }

    .result-top-summary__stat-meta {
        font-size: 8px;
    }
}

.result-top-weapon-special-list {
    display: grid;
    gap: 8px;
}

.result-top-weapon-special-row {
    display: grid;
    gap: 4px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #f8fafc;
}

.result-top-weapon-special-row__main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.result-top-weapon-special-row__label {
    min-width: 0;
    font-size: 11px;
    font-weight: 700;
    color: #475569;
}

.result-top-weapon-special-row__badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.result-top-weapon-special-row__value {
    font-size: 18px;
    line-height: 1.1;
    font-weight: 800;
    color: #0f172a;
    text-align: right;
}

.result-skill-stack {
    display: grid;
    gap: 8px;
}

.result-skill-card {
    padding: 8px 10px;
}

.result-skill-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 5px;
}

.result-skill-card__title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
    line-height: 1.35;
    word-break: break-word;
}

.result-skill-card__lv {
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    text-align: right;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 700;
}

.result-skill-card__bars {
    gap: 3px;
}

.result-skill-card__bar {
    display: block;
    height: 6px;
    border-radius: 999px;
    background: #d1d5db;
}

.result-skill-card__bar.is-active {
    background: #facc15;
}

.result-skill-card__bar.is-disabled {
    background: #e5e7eb;
    opacity: 0.7;
}

.result-skill-card__bar.is-over {
    background: #ef4444;
}

.result-skill-card__rate {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #2563eb;
    white-space: nowrap;
}

#resultDriftSkillList,
#resultActiveSkillList {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 0.5fr));
    gap: 10px;
    align-items: start;
}

#resultDriftSkillList .result-empty,
#resultActiveSkillList .result-empty {
    grid-column: 1 / -1;
}

#resultDriftSkillList .result-skill-card,
#resultActiveSkillList .result-skill-card {
    min-width: 0;
    padding: 4px 6px;
}

#resultDriftSkillList .result-skill-card__head,
#resultActiveSkillList .result-skill-card__head {
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

#resultDriftSkillList .result-skill-card__title,
#resultActiveSkillList .result-skill-card__title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 10px;
    font-weight: bold;
    line-height: 1.35;
    word-break: break-word;
}

#resultDriftSkillList .result-skill-card__lv,
#resultActiveSkillList .result-skill-card__lv {
    flex: 0 0 42px;
    width: 42px;
    min-width: 42px;
    text-align: right;
    white-space: nowrap;
    font-size: 10px;
    font-weight: bold;
}

#resultDriftSkillList .result-skill-card__bars,
#resultActiveSkillList .result-skill-card__bars {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
}

#resultDriftSkillList .equip-skill-bar,
#resultActiveSkillList .equip-skill-bar {
    height: 2px;
}

#resultDriftSkillList .equip-skill-bar.is-placeholder,
#resultActiveSkillList .equip-skill-bar.is-placeholder {
    background: transparent;
}

#resultDriftSkillList .equip-skill-bar.is-overflow,
#resultActiveSkillList .equip-skill-bar.is-overflow {
    background: #d93025;
}

/* graph */
.result-graph-list {
    display: grid;
    gap: 10px;
}

.result-graph-row {
    padding: 12px;
    border: 1px solid #dbe2ea;
    border-radius: 12px;
    background: #fff;
}

.result-graph-row.is-zero {
    background: #f8fafc;
}

.result-graph-row__head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 8px;
}

.result-graph-row__label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}

.result-graph-row__value {
    font-size: 12px;
    color: #64748b;
    text-align: right;
}

.result-graph-row__value .is-overcap {
    color: #dc2626;
    font-weight: 800;
}

.result-graph-track {
    position: relative;
    height: 18px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.result-graph-track.is-zero {
    background: #d1d5db;
}

.result-graph-bar {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 0;
}

.result-graph-bar:first-child {
    border-top-left-radius: 999px;
    border-bottom-left-radius: 999px;
}

.result-graph-bar:last-child {
    border-top-right-radius: 999px;
    border-bottom-right-radius: 999px;
}

.result-graph-bar--base,
.result-graph-bar--weapon {
    background: #64748b;
}

.result-graph-bar--gain {
    background: #f59e0b;
    box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.95);
}

.result-graph-bar--bonus {
    background: #22c55e;
    box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.95);
}

.result-graph-bar.is-zero,
.result-graph-bar--base.is-zero,
.result-graph-bar--weapon.is-zero,
.result-graph-bar--bonus.is-zero {
    background: #9ca3af;
}

.result-graph-row__diff {
    margin-top: 6px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
}

.result-graph-row__diff.is-plus {
    color: #2563eb;
}

.result-graph-row__diff.is-minus {
    color: #dc2626;
}

.result-graph-row__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.result-legend-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.result-legend-chip.is-base,
.result-legend-chip.is-weapon {
    background: #e2e8f0;
    color: #334155;
}

.result-legend-chip.is-gain {
    background: #fef3c7;
    color: #b45309;
}

.result-legend-chip.is-bonus {
    background: #dcfce7;
    color: #166534;
}

.result-legend-chip.is-zero {
    background: #e5e7eb;
    color: #6b7280;
}

.result-legend-chip.is-overcap {
    background: #fee2e2;
    color: #b91c1c;
}

/* stack */
.result-stack-card {
    padding: 14px;
    border: 1px solid #dbe2ea;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.result-stack-card__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 10px;
}

.result-stack-card__title {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
}

.result-stack-card__sub {
    margin-top: 3px;
    font-size: 11px;
    color: #64748b;
}

.result-stack-card__total {
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
    color: #0f172a;
}

.result-stack-value-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 8px;
}

.result-stack-value-list__item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    line-height: 1.2;
    color: #475569;
}

.result-stack-value-list__dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex: 0 0 8px;
}

.result-stack-value-list__dot.is-physical-base {
    background: #475569;
}

.result-stack-value-list__dot.is-physical-gain {
    background: #60a5fa;
}

.result-stack-value-list__dot.is-element-base {
    background: #0f766e;
}

.result-stack-value-list__dot.is-element-gain {
    background: #2dd4bf;
}

.result-stack-value-list__dot.is-critical-gain {
    background: #a855f7;
}

.result-stack-value-list__dot.is-damage-gain {
    background: #f59e0b;
}

.result-stack-value-list__value {
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
}

.build-screenshot-stack-value-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 4px;
}

.build-screenshot-stack-value-list__item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    line-height: 1.2;
    color: #475569;
}

.build-screenshot-stack-value-list__dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    flex: 0 0 7px;
}

.build-screenshot-stack-value-list__dot.is-physical-base {
    background: #475569;
}

.build-screenshot-stack-value-list__dot.is-physical-gain {
    background: #60a5fa;
}

.build-screenshot-stack-value-list__dot.is-element-base {
    background: #0f766e;
}

.build-screenshot-stack-value-list__dot.is-element-gain {
    background: #2dd4bf;
}

.build-screenshot-stack-value-list__dot.is-critical-gain {
    background: #a855f7;
}

.build-screenshot-stack-value-list__dot.is-damage-gain {
    background: #f59e0b;
}

.build-screenshot-stack-value-list__value {
    font-size: 9px;
    font-weight: 700;
    color: #0f172a;
}

.result-stack-track {
    position: relative;
    height: 22px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.result-stack-bar {
    position: absolute;
    top: 0;
    height: 100%;
    box-shadow: inset 2px 0 0 rgba(255,255,255,0.85);
}

.result-stack-bar:first-child {
    border-top-left-radius: 999px;
    border-bottom-left-radius: 999px;
}

.result-stack-legend-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.result-stack-legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: #f8fafc;
    color: #334155;
}

.result-stack-legend__dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
}

.result-stack-bar.is-physical-base,
.result-stack-legend.is-physical-base {
    background: #475569;
    color: #475569;
}
.result-stack-legend.is-physical-base { background: #e2e8f0; }

.result-stack-bar.is-physical-gain,
.result-stack-legend.is-physical-gain {
    background: #60a5fa;
    color: #60a5fa;
}
.result-stack-legend.is-physical-gain { background: #dbeafe; }

.result-stack-bar.is-element-base,
.result-stack-legend.is-element-base {
    background: #0f766e;
    color: #0f766e;
}
.result-stack-legend.is-element-base {
    background: #ccfbf1;
}

.result-stack-bar.is-element-gain,
.result-stack-legend.is-element-gain {
    background: #2dd4bf;
    color: #0f766e;
}
.result-stack-legend.is-element-gain {
    background: #99f6e4;
}

.result-stack-bar.is-critical-gain,
.result-stack-legend.is-critical-gain {
    background: #a855f7;
    color: #7e22ce;
}
.result-stack-legend.is-critical-gain { background: #f3e8ff; }

.result-stack-bar.is-damage-gain,
.result-stack-legend.is-damage-gain {
    background: #f59e0b;
    color: #b45309;
}
.result-stack-legend.is-damage-gain { background: #fef3c7; }

/* ------------------------------
   Debug
------------------------------ */
.build-debug-panel {
    margin-top: 14px;
    border: 1px solid #dbe2ea;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.build-debug-panel summary {
    padding: 12px 14px;
    cursor: pointer;
    font-weight: 700;
    background: #f8fafc;
}

.build-debug-panel pre {
    margin: 0;
    padding: 14px;
    background: #0f172a;
    color: #e2e8f0;
    overflow: auto;
}

/* ------------------------------
   Custom style
------------------------------ */
.custom-style-panel[hidden] { display:none !important; }
.custom-style-panel__hint { margin:4px 0 0; font-size:12px; color:#64748b; }
.custom-style-panel__body { display:grid; gap:12px; }

.custom-style-preview {
    position: relative;
    display:grid;
    grid-template-columns:repeat(3, minmax(0,1fr));
    gap:8px;
}

.custom-style-preview.is-flash {
    animation: customStylePreviewFlash 0.35s ease;
}

@keyframes customStylePreviewFlash {
    0% { transform: scale(1); filter: brightness(1); }
    35% { transform: scale(1.015); filter: brightness(1.08); }
    100% { transform: scale(1); filter: brightness(1); }
}

.custom-style-preview--top {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 2px;
}

.custom-style-preview__row {
    border:1px solid #dbe2ea;
    border-radius:12px;
    background:#fff;
    padding:10px 12px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    font-size:12px;
    white-space: nowrap;
}

.custom-style-preview__row strong {
    font-size:14px;
    color:#0f172a;
    white-space: nowrap;
}

.custom-style-preview__label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.custom-style-preview__img {
    display: block;
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.custom-style-level-display {
    display: flex;
    align-items: baseline;
    gap: 6px;
    padding: 0 2px;
}

.custom-style-level-display__prefix {
    font-size: 15px;
    font-style: italic;
    color: #64748b;
}

.custom-style-level-display__value {
    font-size: 24px;
    line-height: 1;
    font-weight: 800;
    color: #0f172a;
}

.custom-style-slider-wrap {
    position: relative;
    display: grid;
    gap: 8px;
}

.custom-style-slider {
    --style-slider-percent: 0%;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 22px;
    border-radius: 999px;
    background:
        linear-gradient(90deg,
            #7c3aed 0%,
            #8b5cf6 var(--style-slider-percent),
            #e5e7eb var(--style-slider-percent),
            #e5e7eb 100%);
    border: 1px solid #d8dee9;
    box-shadow:
        inset 0 2px 4px rgba(15, 23, 42, 0.10),
        0 1px 0 rgba(255,255,255,0.8);
    cursor: pointer;
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.custom-style-slider:hover {
    box-shadow:
        inset 0 2px 5px rgba(15, 23, 42, 0.12),
        0 0 0 3px rgba(124, 58, 237, 0.08);
}

.custom-style-slider:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.custom-style-slider::-webkit-slider-runnable-track {
    height: 22px;
    background: transparent;
    border: none;
}

.custom-style-slider::-moz-range-track {
    height: 22px;
    background: transparent;
    border: none;
}

.custom-style-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    margin-top: -3px;
    border-radius: 999px;
    border: 2px solid #ffffff;
    background:
        radial-gradient(circle at 35% 35%, #ffffff 0%, #f8fafc 30%, #dbeafe 32%, #7c3aed 100%);
    box-shadow:
        0 4px 10px rgba(76, 29, 149, 0.25),
        0 0 0 1px rgba(124, 58, 237, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.custom-style-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 2px solid #ffffff;
    background:
        radial-gradient(circle at 35% 35%, #ffffff 0%, #f8fafc 30%, #dbeafe 32%, #7c3aed 100%);
    box-shadow:
        0 4px 10px rgba(76, 29, 149, 0.25),
        0 0 0 1px rgba(124, 58, 237, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.custom-style-slider:active::-webkit-slider-thumb,
.custom-style-slider:active::-moz-range-thumb {
    transform: scale(1.06);
}

.custom-style-slider-scale {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    padding: 0 2px;
}

.custom-style-milestones {
    display:grid;
    gap:8px;
}

.custom-style-milestone[hidden] { display:none !important; }

.custom-style-milestone {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    border-top: 1px solid #e5e7eb;
    padding-top: 8px;
}

.custom-style-milestone__title {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    white-space: nowrap;
}

.custom-style-milestone.is-locked .custom-style-milestone__title {
    color: #94a3b8;
}

.custom-style-milestone__choices {
    display:flex;
    flex-wrap:nowrap;
    gap:6px;
    min-width:0;
}

.custom-style-choice-btn {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:6px;
    min-width:0;
    padding:7px 10px;
    border:1px solid #d0d9e5;
    border-radius:999px;
    background:#fff;
    color:#334155;
    font-size:12px;
    font-weight:700;
    cursor:pointer;
    transition:
        transform 0.14s ease,
        background 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        opacity 0.18s ease;
    flex:1 1 0;
    white-space:nowrap;
    position:relative;
    overflow:hidden;
}

.custom-style-choice-btn__icon {
    display: block;
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex: 0 0 16px;
}

.custom-style-choice-btn__value {
    display: inline-block;
    font-weight: 800;
    line-height: 1;
}

.custom-style-choice-btn:hover {
    border-color: #93c5fd;
    background: #f8fbff;
}

.custom-style-choice-btn.is-active {
    border-color: #7c3aed;
    background: #f3e8ff;
    color: #5b21b6;
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.18);
}

.custom-style-choice-btn.is-disabled,
.custom-style-choice-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #94a3b8;
    box-shadow: none;
}

.custom-style-choice-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.24) 45%, transparent 70%);
    transform: translateX(-120%);
    pointer-events: none;
}

.custom-style-choice-btn.is-active::after {
    animation: customStyleChoiceShine 0.45s ease;
}

.custom-style-choice-btn.is-pop {
    animation: customStyleChoicePop 0.24s ease;
}

@keyframes customStyleChoiceShine {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

@keyframes customStyleChoicePop {
    0% { transform: scale(1); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* ------------------------------
   Preset toolbar
------------------------------ */
.build-inline-actions--preset-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin-top: 8px;
}

.activation-row__select--preset {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-width: 0;
    flex: 1 1 auto;
    max-width: 260px;
    height: 34px;
    padding: 0 34px 0 12px;
    border: 1px solid #cfd8e3;
    border-radius: 10px;
    background:
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    box-sizing: border-box;
    cursor: pointer;
    background-image:
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20'%3E%3Cpath fill='%2364758b' d='M5 7l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat, no-repeat;
    background-position: 0 0, right 10px center;
    background-size: auto, 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.activation-row__select--preset:hover {
    border-color: #93c5fd;
    background-image:
        linear-gradient(180deg, #ffffff 0%, #f1f7ff 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20'%3E%3Cpath fill='%233b82f6' d='M5 7l5 5 5-5z'/%3E%3C/svg%3E");
}

.activation-row__select--preset:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
    background-image:
        linear-gradient(180deg, #ffffff 0%, #eff6ff 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20'%3E%3Cpath fill='%232563eb' d='M5 7l5 5 5-5z'/%3E%3C/svg%3E");
}

.build-inline-actions--preset-row .edit-btn {
    min-width: 34px;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    line-height: 1;
    position: relative;
    flex: 0 0 auto;
}

.build-inline-actions--preset-row .edit-btn::before {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

#skillPresetNewButton::before { content: "⧉"; }
#skillPresetDeleteButton::before {
    content: "×";
    font-size: 13px;
    font-weight: 800;
}

#skillPresetNewButton {
    border: 1px solid #bfdbfe;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    color: #1d4ed8;
}

#skillPresetNewButton:hover {
    border-color: #93c5fd;
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.16);
}

#skillPresetDeleteButton {
    border: 1px solid #fecaca;
    background: linear-gradient(180deg, #fff5f5 0%, #fee2e2 100%);
    color: #dc2626;
}

#skillPresetDeleteButton:hover {
    border-color: #fca5a5;
    background: linear-gradient(180deg, #fee2e2 0%, #fecaca 100%);
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.14);
}

.build-inline-actions--preset-row .edit-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

#skillPresetDeleteButton:disabled {
    border-color: #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    color: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 1;
}

#skillPresetDeleteButton:disabled:hover {
    border-color: #e2e8f0;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    box-shadow: none;
    transform: none;
}

/* ------------------------------
   Responsive
------------------------------ */
@media (max-width: 900px) {
    .activation-row__input {
        width: 38px;
        min-width: 38px;
    }

    #buildFavoriteButton,
    #buildSaveButton,
    #buildRecalculateButton {
        min-width: 76px;
        min-height: 36px;
        padding: 8px 12px;
    }

    #buildFavoriteButton,
    #buildSaveButton {
        font-size: 12px;
    }

    #buildRecalculateButton {
        font-size: 12px;
    }

    .result-top-summary__card--metrics-compact {
        gap: 8px;
    }

    .result-top-summary__stat-main {
        gap: 4px;
    }

    .result-top-summary__stat-icon {
        width: 13px;
        height: 13px;
        flex-basis: 13px;
    }

    .result-top-summary__stat-value {
        font-size: 13px;
    }

    .result-top-summary__stat-meta {
        font-size: 8px;
    }

    .build-custom-style-box {
        padding: 10px 12px;
        border-radius: 12px;
    }

    .build-custom-style-box__head {
        margin-bottom: 8px;
        gap: 8px;
    }

    .build-custom-style-box__title {
        font-size: 13px;
        line-height: 1.25;
    }

    .build-custom-style-box__hint,
    .custom-style-hint,
    #customStyleHint {
        margin-top: 8px;
        font-size: 11px;
        line-height: 1.45;
    }

    .custom-style-preview {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 8px;
    }

    .custom-style-preview__row {
        min-width: 0;
        padding: 5px 6px;
        border-radius: 8px;
        gap: 4px;
        justify-content: center;
    }

    .custom-style-preview__label {
        width: 18px;
        height: 18px;
        flex: 0 0 18px;
    }

    .custom-style-preview__img {
        width: 18px;
        height: 18px;
    }

    .custom-style-preview__row strong,
    .custom-style-preview__value {
        font-size: 12px;
        line-height: 1.1;
    }

    .custom-style-level-display {
        margin-bottom: 8px;
        padding: 4px 8px;
        gap: 4px;
        border-radius: 999px;
    }

    .custom-style-level-display__prefix {
        font-size: 10px;
        line-height: 1;
    }

    .custom-style-level-display__value {
        font-size: 16px;
        line-height: 1;
    }

    .custom-style-slider-wrap {
        margin-bottom: 8px;
    }

    .custom-style-slider {
        height: 4px;
        min-height: 4px;
    }

    .custom-style-slider::-webkit-slider-runnable-track {
        height: 4px;
        border-radius: 999px;
    }
    
    .custom-style-slider::-moz-range-progress {
        height: 4px;
        border-radius: 999px;
    }

    .custom-style-slider::-moz-range-track {
        height: 4px;
        border-radius: 999px;
    }

    .custom-style-slider::-webkit-slider-thumb {
        width: 14px;
        height: 14px;
        margin-top: -6px;
    }

    .custom-style-slider::-moz-range-thumb {
        width: 14px;
        height: 14px;
    }

    .custom-style-milestones {
        grid-template-columns: 1fr;
        gap: 6px;
        margin-top: 8px;
    }

    .custom-style-milestone {
        grid-template-columns: 42px minmax(0, 1fr);
        align-items: center;
        gap: 6px;
        padding: 6px 8px;
        border-radius: 10px;
    }

    .custom-style-milestone__title {
        margin: 0;
        font-size: 11px;
        line-height: 1.1;
        white-space: nowrap;
    }

    .custom-style-milestone__choices {
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
        min-width: 0;
    }

    .custom-style-choice-btn {
        min-height: 28px;
        padding: 4px 8px;
        border-radius: 999px;
        font-size: 10px;
        line-height: 1.1;
        white-space: nowrap;
    }
}

@media (max-width: 820px) {
    .build-editor-main {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .build-result-visual .result-visual-grid.result-visual-grid--two {
        grid-template-columns: 1fr;
    }

    .result-top-summary {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: 10px;
    }

    .result-top-summary__card--expected,
    .result-top-summary__card--metrics-compact,
    .result-top-summary__card--weapon-special {
        grid-column: auto;
        grid-row: auto;
    }

    .result-top-summary__card--metrics-compact {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .result-top-summary__stat-row {
        padding: 2px 0;
    }

    .result-top-summary__stat-main {
        gap: 4px;
        min-width: 0;
    }

    .result-top-summary__stat-icon {
        width: 13px;
        height: 13px;
        flex: 0 0 13px;
    }

    .result-top-summary__stat-value {
        font-size: 13px;
        line-height: 1;
    }

    .result-top-summary__stat-meta {
        font-size: 9px;
        line-height: 1;
    }
}

.build-editor-side.is-overlay-mode {
    position: static;
}

.build-editor-side.is-overlay-mode .build-editor-side__handle {
    position: fixed;
    top: 54%;
    right: 0;
    left: auto;
    width: 32px;
    min-height: 112px;
    padding: 12px 0;
    border-right: 1px solid #cfd8e3;
    border-left: none;
    border-radius: 12px 0 0 12px;
    transform: translateY(-50%);
    z-index: 420;
    box-shadow: -4px 10px 24px rgba(15, 23, 42, 0.16);
}

.build-editor-side.is-overlay-mode .build-editor-side__backdrop {
    position: fixed;
    inset: 0;
    display: block;
    background: rgba(15, 23, 42, 0.42);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.18s ease, visibility 0.18s ease;
    z-index: 399;
}

.build-editor-side.is-overlay-mode.is-collapsed .build-editor-side__backdrop {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.build-editor-side.is-overlay-mode .build-editor-side__panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(360px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
    height: 100dvh;
    overflow-y: auto;
    padding: 12px;
    background: #f5f7fb;
    box-shadow: -10px 0 28px rgba(15, 23, 42, 0.18);
    transform: translateX(0);
    opacity: 1;
    z-index: 400;
    transition: transform 0.22s ease, opacity 0.18s ease;
    overscroll-behavior: contain;
}

.build-editor-side.is-overlay-mode.is-collapsed .build-editor-side__panel {
    transform: translateX(100%);
    opacity: 1;
    pointer-events: none;
}

@media (max-width: 640px) {
    .build-editor-layout,
    .build-editor-layout.is-side-collapsed {
        grid-template-columns: minmax(0, 1fr);
        padding: 10px;
        gap: 10px;
    }

    .build-editor-main {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .build-panel {
        gap: 10px;
    }

    .build-section {
        padding: 10px;
        border-radius: 14px;
    }

    .build-section__head {
        margin-bottom: 10px;
    }

    .build-section__head h3 {
        font-size: 16px;
    }

    .build-section__sub,
    .build-section__desc {
        font-size: 11px;
        line-height: 1.5;
    }

    .custom-param-grid,
    .result-summary-grid {
        grid-template-columns: 1fr;
    }

    .custom-param-grid--basic {
        gap: 6px 8px;
    }

    .activation-row--custom-field {
        grid-template-columns: minmax(0, 1fr) 52px 12px;
    }

    .custom-bowgun-mode-head {
        grid-template-columns: minmax(0, 1fr) 150px;
        gap: 8px;
    }

    .custom-select-field--inline .custom-select-field__select,
    .custom-select-field__select {
        min-height: 34px;
        font-size: 12px;
    }

    .custom-select-field__select {
        max-width: 150px;
        padding: 0 8px;
    }

    .custom-param-group .activation-row--select {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .custom-param-group .activation-row--select .activation-row__select {
        min-width: 0;
        max-width: none;
        width: 100%;
    }

    .build-editor-side {
        position: static;
    }

    .build-editor-side__handle {
        position: fixed;
        top: 54%;
        right: 0;
        left: auto;
        width: 32px;
        min-height: 112px;
        padding: 12px 0;
        border-right: 1px solid #cfd8e3;
        border-left: none;
        border-radius: 12px 0 0 12px;
        transform: translateY(-50%);
        z-index: 420;
        box-shadow: -4px 10px 24px rgba(15, 23, 42, 0.16);
    }

    .build-editor-side__backdrop {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(15, 23, 42, 0.42);
        opacity: 1;
        visibility: visible;
        transition: opacity 0.18s ease, visibility 0.18s ease;
        z-index: 399;
    }

    .build-editor-side.is-collapsed .build-editor-side__backdrop {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .build-editor-side__panel {
        position: fixed;
        top: 0;
        right: 0;
        width: min(360px, calc(100vw - 28px));
        max-width: calc(100vw - 28px);
        height: 100dvh;
        overflow-y: auto;
        padding: 12px;
        background: #f5f7fb;
        box-shadow: -10px 0 28px rgba(15, 23, 42, 0.18);
        transform: translateX(0);
        opacity: 1;
        z-index: 400;
        transition: transform 0.22s ease, opacity 0.18s ease;
        overscroll-behavior: contain;
    }

    .build-editor-side.is-collapsed .build-editor-side__panel {
        transform: translateX(100%);
        opacity: 1;
        pointer-events: none;
    }

    .build-editor-side__panel .build-section {
        margin: 0;
    }


    .build-result-visual .result-visual-grid.result-visual-grid--two > .result-visual-card {
        min-width: 0;
    }

    .build-slot-card {
        min-height: 82px;
    }

    .build-slot-card__value,
    .build-slot-card__empty {
        min-height: 82px;
    }

    .build-slot-card__label {
        padding: 6px 10px 0;
        font-size: 10px;
    }

    .build-slot-card .equip-card--compact {
        padding: 8px 10px;
    }

    .build-slot-card .equip-card__head {
        margin-bottom: 4px;
    }

    .build-slot-card .equip-name {
        font-size: 11px;
        line-height: 1.25;
    }

    .build-slot-card .equip-stats {
        gap: 3px 6px;
        margin-bottom: 3px;
    }

    .build-slot-card .equip-stat,
    .build-slot-card .equip-stat span {
        font-size: 10px;
    }

    .build-slot-card .equip-skills {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
        margin-top: 6px;
    }

    .build-slot-card .equip-skill-card {
        padding: 4px 5px;
    }

    .build-slot-card .equip-skill-head {
        gap: 4px;
        margin-bottom: 3px;
    }

    .build-slot-card .equip-skill-title,
    .build-slot-card .equip-skill-lv {
        font-size: 9px;
        line-height: 1.25;
    }

    .weapon-type-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .build-drift-box {
        margin-top: 10px;
        padding: 10px;
        border-radius: 12px;
    }

    .build-drift-box__head {
        gap: 8px;
        margin-bottom: 8px;
    }

    .build-drift-box__title {
        font-size: 13px;
    }

    .build-drift-box__meta,
    .build-drift-box__meta strong,
    .build-drift-box__meta span {
        font-size: 12px;
    }

    .build-drift-box__add-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .drift-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .drift-skill-card {
        padding: 5px 6px;
        border-radius: 8px;
    }

    .drift-skill-card__head {
        gap: 4px;
        margin-bottom: 3px;
    }

    .drift-skill-card__name,
    .drift-skill-card__level {
        font-size: 9px;
        line-height: 1.25;
    }

    .drift-level-stepper-btn {
        width: 14px;
        height: 14px;
        min-width: 14px;
        font-size: 8px;
    }

    .drift-skill-card__remove {
        width: 16px;
        height: 16px;
        min-width: 16px;
        font-size: 10px;
    }

    .drift-skill-card__bars {
        gap: 2px;
    }

    .result-top-summary {
        gap: 8px;
    }

    .result-top-summary__card {
        padding: 10px 12px;
        border-radius: 12px;
    }

    .result-top-summary__label {
        margin-bottom: 4px;
        font-size: 10px;
        line-height: 1.15;
    }

    .result-top-summary__expected-row {
        gap: 8px;
        padding: 5px 0;
    }

    .result-top-summary__expected-badge {
        min-width: 58px;
        min-height: 20px;
        padding: 0 7px;
        font-size: 9px;
    }

    .result-top-summary__expected-value {
        font-size: 15px;
        line-height: 1;
    }

    .result-top-summary__card--metrics-compact {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .result-top-summary__stat-row {
        padding: 2px 0;
    }

    .result-top-summary__stat-main {
        gap: 4px;
    }

    .result-top-summary__stat-icon {
        width: 13px;
        height: 13px;
        flex: 0 0 13px;
    }

    .result-top-summary__stat-value {
        font-size: 13px;
        line-height: 1;
    }

    .result-top-summary__stat-meta {
        font-size: 9px;
        line-height: 1;
    }

    .result-top-weapon-special-row {
        padding: 7px 8px;
        border-radius: 8px;
        gap: 3px;
    }

    .result-top-weapon-special-row__label {
        font-size: 10px;
    }

    .result-top-weapon-special-row__badge {
        min-height: 18px;
        padding: 0 6px;
        font-size: 9px;
    }

    .result-top-weapon-special-row__value {
        font-size: 14px;
    }

    .result-visual-section {
        gap: 8px;
    }

    .result-visual-grid {
        gap: 8px;
    }

    .result-visual-card {
        padding: 8px;
        border-radius: 10px;
    }

    .result-visual-card__title {
        margin-bottom: 6px;
        font-size: 10px;
        line-height: 1.2;
    }

    .result-empty {
        padding: 8px;
        border-radius: 8px;
        font-size: 10px;
        line-height: 1.5;
    }

    .result-equip-list {
        gap: 6px;
    }

    .result-equip-row {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 6px;
        padding: 6px 7px;
        border-radius: 8px;
    }

    .result-equip-row__label {
        font-size: 10px;
    }

    .result-equip-row__main {
        gap: 6px;
    }

    .result-equip-row__icons {
        gap: 1px;
    }

    .result-equip-row__icon {
        width: 14px;
        height: 14px;
    }

    .result-equip-row__name,
    .result-equip-row__empty {
        font-size: 10px;
        line-height: 1.3;
    }

    #resultDriftSkillList {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    #resultDriftSkillList .result-skill-card,
    #resultActiveSkillList .result-skill-card {
        padding: 4px 5px;
        border-radius: 8px;
    }

    #resultActiveSkillList {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    #resultDriftSkillList .result-skill-card__head,
    #resultActiveSkillList .result-skill-card__head {
        gap: 4px;
        margin-bottom: 3px;
        align-items: flex-start;
    }

    #resultDriftSkillList .result-skill-card__title,
    #resultActiveSkillList .result-skill-card__title {
        font-size: 9px;
        line-height: 1.25;
        font-weight: 700;
    }

    #resultDriftSkillList .result-skill-card__lv,
    #resultActiveSkillList .result-skill-card__lv {
        width: auto;
        min-width: 0;
        flex: 0 0 auto;
        font-size: 9px;
        line-height: 1.2;
    }

    #resultDriftSkillList .result-skill-card__bars,
    #resultActiveSkillList .result-skill-card__bars {
        gap: 2px;
    }

    #resultDriftSkillList .equip-skill-bar,
    #resultActiveSkillList .equip-skill-bar {
        height: 2px;
    }

    .result-skill-card__rate {
        margin-left: 3px;
        font-size: 9px;
    }

    .result-graph-list {
        gap: 8px;
    }

    .result-graph-row {
        padding: 8px;
        border-radius: 10px;
    }

    .result-graph-row__head {
        gap: 6px;
        margin-bottom: 6px;
    }

    .result-graph-row__label {
        font-size: 11px;
        line-height: 1.25;
    }

    .result-graph-row__value {
        font-size: 10px;
    }

    .result-graph-track {
        height: 14px;
    }

    .result-graph-row__diff {
        margin-top: 4px;
        font-size: 10px;
    }

    .result-graph-row__legend {
        gap: 4px;
        margin-top: 6px;
    }

    .result-legend-chip {
        padding: 3px 6px;
        font-size: 9px;
    }

    .build-inline-actions {
        gap: 6px;
    }

    #buildFavoriteButton,
    #buildSaveButton,
    #buildRecalculateButton {
        width: 38px;
        min-width: 38px;
        height: 38px;
        min-height: 38px;
        padding: 0;
        font-size: 0 !important;
        line-height: 0;
        text-indent: -9999px;
        white-space: nowrap;
        border-radius: 10px;
    }

    #buildFavoriteButton::before,
    #buildSaveButton::before,
    #buildRecalculateButton::before {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        margin-right: 0;
        font-size: 16px;
        line-height: 1;
        text-indent: 0;
    }

    .build-modal__dialog,
    .build-modal__dialog--narrow {
        width: calc(100vw - 16px);
        margin: 8px auto;
        max-height: calc(100vh - 16px);
    }

    .equip-picker-results {
        grid-template-columns: 1fr;
    }

    .equip-picker-card {
        width: 100%;
    }

    .build-inline-actions--preset-row {
        gap: 6px;
    }

    .activation-row__select--preset {
        flex: 1 1 100%;
        min-width: 0;
    }

    .result-top-summary__stats {
        grid-template-columns: 1fr;
    }

    .result-top-summary__metric {
        font-size: 20px;
    }

    .result-stack-card__head {
        align-items: flex-start;
        flex-direction: column;
    }
    
    .result-stack-value-list {
        gap: 4px 8px;
        margin-top: 6px;
    }

    .result-stack-value-list__item {
        font-size: 10px;
    }

    .result-stack-value-list__value {
        font-size: 10px;
    }    
}

@media (max-width: 380px) {
    .result-top-summary {
        grid-template-columns: 1fr;
    }

    .result-visual-grid--two {
        grid-template-columns: 1fr;
    }

    .drift-list {
        grid-template-columns: 1fr;
    }

    #resultDriftSkillList,
    #resultActiveSkillList {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


.drift-picker-item.is-disabled,
.drift-picker-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.2);
}

.drift-picker-item.is-disabled .drift-picker-item__name,
.drift-picker-item:disabled .drift-picker-item__name {
    text-decoration: line-through;
}

.drift-picker-item.is-disabled::after,
.drift-picker-item:disabled::after {
    content: "選択済み";
    margin-left: 8px;
    font-size: 11px;
    color: #64748b;
}

.result-top-weapon-special-row__inline {
    display: inline-block;
    margin-left: 0.35rem;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 700;
}

.result-top-weapon-special-row--bow {
    gap: 2px;
    padding: 6px 8px;
}

.result-top-weapon-special-row--bow .result-top-weapon-special-row__main {
    align-items: center;
}

.result-top-weapon-special-row--bow .result-top-weapon-special-row__label {
    font-size: 10px;
    line-height: 1.1;
    font-weight: 700;
}

.result-top-weapon-special-row--bow .result-top-weapon-special-row__value {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 700;
}

.result-top-weapon-special-row--bow-best {
    gap: 2px;
    padding: 6px 8px;
}

.result-top-weapon-special-row--bow-best .result-top-weapon-special-row__label {
    font-size: 10px;
    line-height: 1.1;
    font-weight: 700;
}

.result-top-weapon-special-row--bow-best .result-top-weapon-special-row__value {
    font-size: 11px;
    line-height: 1.2;
    font-weight: 700;
}

.result-top-weapon-special-row--bowgun-requirement {
    align-items: center;
}

.result-top-weapon-special-row__value--bowgun-requirement {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
}

.result-top-weapon-special-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    font-weight: 600;
    line-height: 1.2;
}

.result-top-weapon-special-inline__icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex: 0 0 auto;
}

.result-top-weapon-special-inline__text {
    display: inline-block;
    white-space: nowrap;
}

.result-top-weapon-special-inline.is-insufficient {
    color: #c62828;
}


.result-top-bow-row {
    display: grid;
    grid-template-columns: 48px 110px 1fr;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.result-top-bow-row__level {
    font-weight: 700;
    white-space: nowrap;
}

.result-top-bow-row__shot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.result-top-bow-shot__icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex: 0 0 auto;
}

.result-top-bow-shot__text {
    white-space: nowrap;
    font-weight: 400;
}

.result-top-bow-row__values {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
    justify-content: flex-end; /* ←追加 */
    text-align: right;         /* ←追加 */    
}

.result-top-bow-values__item {
    white-space: nowrap;
    text-align: right; /* ←追加 */
}

.result-top-bow-values__empty {
    color: #777;
    white-space: nowrap;
}


@media (max-width: 768px) {
    .result-top-weapon-special-row__value--bowgun-requirement {
        gap: 10px;
    }

    .result-top-weapon-special-inline {
        font-size: 0.92rem;
    }
    .result-top-bow-row {
        grid-template-columns: 44px 96px 1fr;
        gap: 8px;
    }

    .result-top-bow-shot__icon {
        width: 18px;
        height: 18px;
    }

    .result-top-bow-row__values {
        gap: 8px;
    }    
}

/* ------------------------------
   Screenshot modal
------------------------------ */
body.is-screenshot-modal-open {
    overflow: hidden;
}

.build-screenshot-modal[hidden] {
    display: none !important;
}

.build-screenshot-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
}

.build-screenshot-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(2px);
    z-index: 0;
}

.build-screenshot-modal__dialog {
    position: relative;
    z-index: 1;

    display: flex;
    align-items: flex-start;   /* ←ここ変更 */
    justify-content: center;

    width: 100%;
    min-height: 100dvh;

    padding: 16px 12px;        /* ←上余白少し増やす */
    box-sizing: border-box;
}

.build-screenshot-card {
    width: min(1080px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    overflow: auto;
    padding: 10px;
    border: 1px solid #dbe4ee;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    box-sizing: border-box;
    margin: 0 auto;   /* 中央固定 */
}

.build-screenshot-modal__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.build-screenshot-modal__toolbar h2 {
    margin: 0;
    font-size: 13px;
    line-height: 1.2;
    color: #0f172a;
}

.build-screenshot-summary,
.build-screenshot-main,
.build-screenshot-bottom {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.build-screenshot-panel {
    padding: 8px 9px;
    border: 1px solid #d7e0ea;
    border-radius: 12px;
    background: #f8fbff;
    min-width: 0;
}

.build-screenshot-panel__title {
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.build-screenshot-panel__title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}

.build-screenshot-panel__title-row .build-screenshot-panel__title {
    margin-bottom: 0;
}

.build-screenshot-panel__meta {
    font-size: 10px;
    font-weight: 700;
    color: #334155;
    white-space: nowrap;
}

.build-screenshot-panel__meta strong,
.build-screenshot-panel__meta span {
    color: inherit;
}

.build-screenshot-panel__meta.is-over {
    color: #dc2626;
}

.build-screenshot-panel--skills {
    margin-bottom: 8px;
}

/* 上段 */
.build-screenshot-summary {
    grid-template-columns: 1.05fr 1.15fr;
}

.build-screenshot-expected-list {
    display: grid;
    gap: 2px;
}

.build-screenshot-expected-row {
    display: grid;
    grid-template-columns: 58px 1fr;
    align-items: end;
    gap: 4px;
}

.build-screenshot-expected-row__label {
    font-size: 10px;
    font-weight: 600;
    color: #334155;
    line-height: 1.15;
}

.build-screenshot-expected-row__value {
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.05;
}

.build-screenshot-stat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.build-screenshot-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.build-screenshot-stat-item__icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    flex: 0 0 auto;
}

.build-screenshot-stat-item__value {
    font-size: 12px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.05;
}

.build-screenshot-stat-item__meta {
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    line-height: 1.05;
    white-space: nowrap;
}

/* 基本リスト */
#screenshotEquipList,
#screenshotDriftSkillList,
#screenshotWeaponSpecialList,
#screenshotGraphList {
    display: grid;
    gap: 4px;
}

#screenshotActiveSkillList {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
}

.build-screenshot-empty {
    padding: 10px;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.45;
}

/* 装備構成は枠なし・非ボールド */
.build-screenshot-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.build-screenshot-row__icons {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: 0 0 auto;
}

.build-screenshot-row__icons img {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.build-screenshot-row__name {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.2;
    color: #0f172a;
    word-break: break-word;
}

#screenshotEquipList .build-screenshot-row {
    padding: 4px 6px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #ffffff;
    margin-bottom: 4px;
}

#screenshotEquipList .build-screenshot-row__icons img {
    width: 15px;
    height: 15px;
}

#screenshotEquipList .build-screenshot-row__name {
    font-size: 10px;
    font-weight: 400;
    line-height: 1.15;
}

/* 錬成・発動スキルは枠もバーも消す */
#screenshotDriftSkillList .equip-skill-card,
#screenshotDriftSkillList .result-skill-card,
#screenshotActiveSkillList .equip-skill-card,
#screenshotActiveSkillList .result-skill-card {
    margin: 0;
    padding: 4px 6px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: none;
    min-width: 0;
}

#screenshotDriftSkillList .equip-skill-head,
#screenshotDriftSkillList .result-skill-card__head,
#screenshotActiveSkillList .equip-skill-head,
#screenshotActiveSkillList .result-skill-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 0;
}

#screenshotDriftSkillList .equip-skill-title,
#screenshotDriftSkillList .result-skill-card__title,
#screenshotActiveSkillList .equip-skill-title,
#screenshotActiveSkillList .result-skill-card__title {
    min-width: 0;
    font-size: 10px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.2;
    word-break: break-word;
}

#screenshotDriftSkillList .result-skill-card__rate,
#screenshotActiveSkillList .result-skill-card__rate {
    display: inline;
    margin-left: 3px;
    font-size: 9px;
    font-weight: 600;
    color: #2563eb;
}

#screenshotDriftSkillList .equip-skill-lv,
#screenshotDriftSkillList .result-skill-card__lv,
#screenshotActiveSkillList .equip-skill-lv,
#screenshotActiveSkillList .result-skill-card__lv {
    flex: 0 0 auto;
    font-size: 9px;
    font-weight: 700;
    color: #334155;
    white-space: nowrap;
}

#screenshotDriftSkillList .equip-skill-bars,
#screenshotDriftSkillList .result-skill-card__bars,
#screenshotActiveSkillList .equip-skill-bars,
#screenshotActiveSkillList .result-skill-card__bars {
    display: none !important;
}

/* 武器特有 */
.build-screenshot-inline-badge {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 5px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 9px;
    font-weight: 700;
    vertical-align: middle;
}

.build-screenshot-row__icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    vertical-align: middle;
}

/* グラフをコンパクト化 */
#screenshotGraphList {
    display: grid;
    gap: 4px;
}

/* 武器特有がない場合はグラフ全幅 */
.build-screenshot-bottom > .is-full-width {
    grid-column: 1 / -1;
}

/* 広告対策 */
body.is-screenshot-modal-open #asumi-frame-136-456 {
    display: none !important;
}

body.is-screenshot-modal-open iframe[src*="shinobi.jp"],
body.is-screenshot-modal-open [src*="shinobi.jp"],
body.is-screenshot-modal-open [id^="asumi-frame-"],
body.is-screenshot-modal-open [id*="admax"],
body.is-screenshot-modal-open [class*="admax"] {
    visibility: hidden !important;
    pointer-events: none !important;
}

#buildScreenshotButton {
    min-width: 42px;
    width: 42px;
    padding-left: 0;
    padding-right: 0;
    justify-content: center;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
}

#buildScreenshotButton::before {
    font-size: 16px;
    line-height: 1;
    margin: 0;
}

#buildScreenshotButton {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s ease;
}

#buildScreenshotButton:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

#buildScreenshotButton {
    display: none;
}


/* モバイル */
@media (max-width: 768px) {
    .build-screenshot-card {
        width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
        padding: 8px;
        border-radius: 14px;
    }

    .build-screenshot-summary,
    .build-screenshot-main,
    .build-screenshot-bottom {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        margin-bottom: 6px;
    }

    .build-screenshot-panel {
        padding: 7px 8px;
        border-radius: 10px;
    }

    .build-screenshot-panel__title {
        font-size: 10px;
        margin-bottom: 5px;
    }

    .build-screenshot-panel__meta {
        font-size: 9px;
    }

    .build-screenshot-expected-row {
        grid-template-columns: 54px 1fr;
        gap: 4px;
    }

    .build-screenshot-expected-row__label,
    .build-screenshot-expected-row__value,
    .build-screenshot-stat-item__value,
    .build-screenshot-stat-item__meta,
    .build-screenshot-row__name {
        font-size: 10px;
    }

    #screenshotEquipList .build-screenshot-row__icons img,
    .build-screenshot-row__icons img {
        width: 14px;
        height: 14px;
    }

    #screenshotGraphList .result-stack-card {
        grid-template-columns: 44px minmax(0, 1fr) 38px;
        gap: 5px;
        padding: 4px 5px;
    }

    #screenshotGraphList .result-stack-card__title,
    #screenshotGraphList .result-stack-card__total {
        font-size: 9px;
    }

    #screenshotGraphList .result-stack-track {
        height: 8px;
    }    
    
    #buildScreenshotButton {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        min-width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 12px;
        line-height: 1;
        font-size: 0;
        background: #ffffff;
        color: #334155;
        border: 1px solid #cbd5e1;
        box-sizing: border-box;
    }

    #buildScreenshotButton:hover {
        background: #f8fafc;
        border-color: #94a3b8;
    }

    #buildScreenshotButton .build-screenshot-button__icon {
        display: block;
        font-size: 15px;
        line-height: 1;
        transform: translateY(-0.5px);
    }
}

body.is-screenshot-modal-open * {
    visibility: hidden !important;
}

body.is-screenshot-modal-open .build-screenshot-modal,
body.is-screenshot-modal-open .build-screenshot-modal * {
    visibility: visible !important;
}

#buildScreenshotSaveButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s ease;
}

#buildScreenshotSaveButton:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

#buildScreenshotSaveButton:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.build-screenshot-modal__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.build-screenshot-modal__actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.build-screenshot-modal__action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    min-height: 36px;
    padding: 8px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.build-screenshot-modal__action-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.build-screenshot-modal__action-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.build-screenshot-modal__action-btn--close {
    min-width: 72px;
}

.build-screenshot-capture-target {
    display: block;
    padding: 14px;
    border: 1px solid #dbe2ea;
    border-radius: 14px;
    background: #ffffff;
    box-sizing: border-box;
}

@media (max-width: 640px) {
    .build-screenshot-modal__toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .build-screenshot-modal__actions {
        width: 100%;
        justify-content: flex-end;
    }

    .build-screenshot-modal__action-btn {
        min-width: 82px;
        min-height: 34px;
        padding: 7px 12px;
        font-size: 12px;
    }
}

.build-screenshot-stack-card {
    display: grid;
    gap: 4px;
    padding: 6px 8px;
    border: 1px solid #d7e0ea;
    border-radius: 10px;
    background: #ffffff;
}

.build-screenshot-stack-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.build-screenshot-stack-card__title {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    color: #0f172a;
}

.build-screenshot-stack-card__total {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    color: #0f172a;
    white-space: nowrap;
}

.build-screenshot-stack-track {
    display: flex;
    width: 100%;
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.build-screenshot-stack-segment {
    display: block;
    height: 100%;
    flex: 0 0 auto;
}

.build-screenshot-stack-segment.is-physical-base {
    background: #475569;
}

.build-screenshot-stack-segment.is-physical-gain {
    background: #60a5fa;
}

.build-screenshot-stack-segment.is-element-base {
    background: #0f766e;
}

.build-screenshot-stack-segment.is-element-gain {
    background: #2dd4bf;
}

.build-screenshot-stack-segment.is-critical-gain {
    background: #a855f7;
}

.build-screenshot-stack-segment.is-damage-gain {
    background: #f59e0b;
}

.build-screenshot-stack-legend-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-top: 4px;
}

.build-screenshot-stack-legend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    line-height: 1.2;
    color: #475569;
}

.build-screenshot-stack-legend__dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex: 0 0 8px;
}

.build-screenshot-stack-legend__dot.is-physical-base {
    background: #475569;
}

.build-screenshot-stack-legend__dot.is-physical-gain {
    background: #60a5fa;
}

.build-screenshot-stack-legend__dot.is-element-base {
    background: #0f766e;
}

.build-screenshot-stack-legend__dot.is-element-gain {
    background: #2dd4bf;
}

.build-screenshot-stack-legend__dot.is-critical-gain {
    background: #a855f7;
}

.build-screenshot-stack-legend__dot.is-damage-gain {
    background: #f59e0b;
}

.build-section-title__emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    vertical-align: middle;
}
