.mobile-confirm-fab {
    display: none;
}

@media (max-width: 900px) {
    .mobile-confirm-fab {
        display: flex;
        position: fixed;
        right: 18px;
        bottom: 24px;
        z-index: 9999;

        align-items: center;
        justify-content: center;

        min-width: 64px;
        height: 64px;
        padding: 0 20px;

        border: none;
        border-radius: 999px;

        background: #F8F546;
        color: #111;

        font-size: 22px;
        font-weight: 900;
        box-shadow:
            0 0 18px rgba(248, 245, 70, 0.45),
            0 8px 22px rgba(0, 0, 0, 0.45);
    }

    .selection-confirm-btn {
        display: none;
    }

    .mobile-confirm-fab:active {
        transform: scale(0.94);
    }

    body {
        margin: 0;
        padding: 10px;
        overflow-x: hidden;
    }

    .builder-shell {
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    .builder-top {
        align-items: stretch;
    }

    .team-top-panel {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 6px;
    }

    .team-preview-slot {
        flex: 0 0 auto;
        width: 82px;
        min-height: 64px;
        padding: 6px;
    }

    .team-preview-operator img {
        width: 34px;
        height: 34px;
    }

    .team-preview-header {
        flex-direction: column;
        gap: 4px;
        font-size: 11px;
        line-height: 1;
    }

    .team-preview-plus {
        width: 30px;
        height: 30px;
        font-size: 24px;
    }

    .builder-divider {
        margin: 14px 0;
    }

    .site-footer {
        margin: 16px 0 10px;
        padding: 10px 2px 0;
        flex-direction: column;
        gap: 4px;
        font-size: 10px;
        line-height: 1.3;
    }

    .builder-content {
        display: flex;
        flex-direction: column;
        gap: 14px;
        min-width: 0;
    }

    .builder-sidebar {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding: 10px;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .builder-panel {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        padding: 12px;
    }

    .builder-sidebar h3 {
        grid-column: 1 / -1;
        margin: 0 0 6px 0;
    }

    .builder-sidebar button {
        width: 100%;
        text-align: center;
        padding: 6px 5px;
        font-size: 11px;
    }

    .sidebar-command {
        min-height: 44px;
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 4px;
        border-left-width: 1px;
        padding: 6px 5px;
    }

    .sidebar-command:hover {
        transform: translateY(-1px);
    }

    .sidebar-command-icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .sidebar-command-label {
        max-width: 100%;
        font-size: 11px;
        font-weight: 700;
        line-height: 1.1;
        white-space: normal;
        overflow: hidden;
        text-overflow: clip;
    }

    .sidebar-command-signal {
        display: none;
    }

    .builder-main {
        gap: 16px;
        width: 100%;
        min-width: 0;
    }

    .skills-panel {
        overflow-x: auto;
        padding: 10px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .skills-panel::after {
        content: "";
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(90deg, transparent, rgba(16, 18, 20, 0.92));
        pointer-events: none;
        z-index: 3;
    }

    .operators-skills-grid {
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 10px;
        width: max-content;
    }

    .operator-skill-wrapper {
        width: 168px;
        gap: 6px;
    }

    .operator-skill-card {
        min-width: 168px;
        min-height: 104px;
        border-radius: 14px;
        padding: 0;
        cursor: pointer;
    }

    .operator-skill-add-card {
        min-width: 168px;
        min-height: 104px;
        border-radius: 14px;
    }

    .operator-skill-add-plus {
        width: 32px;
        height: 28px;
        min-width: 32px;
        min-height: 28px;
        font-size: 22px;
    }

    .operator-skill-card::before {
        top: 30px;
        height: 78px;
    }

    .leader-badge {
        top: 0;
        width: 20px;
        height: 104px;
        padding: 0;
        font-size: 11px;
    }

    .operator-skill-name {
        height: 30px;
        font-size: 13px;
        padding-left: 36px;
        padding-right: 36px;
    }

    .swap-operator-btn,
    .operator-skill-detail-btn {
        top: 15px;
        width: 32px;
        height: 28px;
        min-width: 32px;
        min-height: 28px;
    }

    .swap-operator-btn {
        right: 7px;
    }

    .operator-skill-detail-btn {
        left: 7px;
    }

    .operator-skill-card.leader .operator-skill-detail-btn {
        left: 27px;
    }

    .operator-skill-card.leader .operator-skill-name {
        padding-left: 62px;
    }

    .swap-operator-btn svg {
        width: 15px;
        height: 15px;
    }

    .operator-skill-card .skill-small {
        cursor: grab;
    }

    .operator-icon {
        width: 28px;
        height: 28px;
    }

    .skill-row {
        width: 148px;
        height: 38px;
        gap: 4px;
        padding: 4px 8px;
        border-radius: 12px;
    }

    .skill-small {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        padding: 2px;
    }

    .skill-small.selected {
        outline: none;
        border-color: rgba(248,245,70,0.92);
        box-shadow:
            0 0 12px rgba(248,245,70,0.24),
            inset 0 0 0 1px rgba(248,245,70,0.14);
    }

    .rotation-panel {
        width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        padding: 8px 8px 24px;
    }

    #rotationDropZone {
        width: max-content;
        min-width: 0;
        padding: 28px 0 34px;
    }

    :root.rotation-mode-simulation #rotationDropZone {
        width: 100%;
        min-width: 100%;
    }

    .rotation-slot {
        width: 58px;
        height: 58px;
        overflow: visible;
    }

    .rotation-timeline-labels,
    .rotation-timeline-step {
        grid-template-rows: 18px 58px 78px;
        row-gap: 12px;
    }

    .rotation-timeline-slot-mode .rotation-timeline-labels,
    .rotation-timeline-slot-mode .rotation-timeline-step {
        grid-template-rows: 58px;
        row-gap: 0;
    }

    .rotation-timeline::before {
        left: 50px;
        top: 139px;
    }

    .rotation-timeline-labels {
        min-width: 50px;
        padding-right: 8px;
    }

    .rotation-timeline-label {
        font-size: 10px;
    }

    .rotation-batk-sequence {
        height: 38px;
    }

    .rotation-skill {
        width: 58px;
        height: 58px;
    }

    .rotation-batk-hit-sequence {
        inset: 0 5px;
    }

    .rotation-batk-hit-marker {
        width: 13px;
        height: 13px;
        font-size: 7px;
    }

    .rotation-sim {
        grid-template-columns: 82px 1fr;
    }

    .rotation-sim-cursor-toolbar {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 7px;
    }

    .rotation-sim-cursor-controls {
        grid-column: 1 / -1;
    }

    .rotation-sim-cursor-button {
        min-width: 44px;
        height: 26px;
        padding: 0 7px;
        font-size: 9px;
    }

    .rotation-sim-cursor-stat {
        padding: 4px 6px;
    }

    .rotation-sim-cursor-stat > strong {
        font-size: 10px;
    }

    .rotation-sim-labels,
    .rotation-sim-body {
        grid-template-rows: 24px 104px 58px 122px 56px 60px;
        row-gap: 12px;
    }

    .rotation-sim-skill-track {
        min-height: 104px;
    }

    .rotation-sim-skill-track.is-combo-skill {
        min-height: 122px;
    }

    .rotation-sim .rotation-sim-skill.rotation-skill {
        width: 48px;
        height: 48px;
    }

    .rotation-sim .rotation-sim-skill.is-auto-event {
        --rotation-effect-size: 13px;
        --rotation-effect-tray-width: 58px;
        width: 42px;
        height: 42px;
    }

    .rotation-sim .rotation-sim-skill.is-auto-event .rotation-debuff-tray {
        bottom: -34px;
    }

    .rotation-sim .rotation-sim-skill.is-auto-event .rotation-debuff-tray.is-multi-row {
        bottom: -50px;
    }

    .rotation-sim-cooldown-track {
        min-height: 42px;
    }

    .rotation-sim-cooldown-track.is-combo-skill {
        min-height: 56px;
    }

    .rotation-sim-time-badge {
        right: -12px;
        top: 4px;
        min-width: 30px;
        height: 16px;
        font-size: 9px;
        line-height: 16px;
    }

    .rotation-sim-inspector {
        width: 238px;
        max-width: min(238px, calc(100vw - 24px));
        padding: 9px;
    }

    .rotation-sim-inspector-line {
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 6px;
    }

    .rotation-sim-cooldown-line {
        top: calc(10px + (var(--sim-cd-row, 0) * 9px));
        height: 3px;
    }

    .rotation-sim-cooldown-line span {
        min-width: 38px;
        height: 15px;
        padding: 0 5px;
        font-size: 8px;
        line-height: 15px;
    }

    .rotation-sim-log {
        --sim-log-label-width: 82px;
    }

    .rotation-sim-log-header {
        align-items: flex-start;
        gap: 8px;
    }

    .rotation-sim-problems {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .rotation-sim-problem-chips {
        justify-content: flex-start;
    }

    .rotation-sim-log-list {
        max-height: 220px;
    }

    .rotation-sim-log-event {
        grid-template-columns: 44px 26px minmax(150px, 1fr);
        gap: 6px;
        padding: 6px;
    }

    .rotation-sim-log-icon {
        width: 24px;
        height: 24px;
        border-radius: 6px;
    }

    .rotation-sim-log-sp {
        grid-column: 3;
        justify-self: start;
        max-width: 100%;
        text-align: left;
    }

    .rotation-arrow {
        font-size: 18px;
        min-width: 18px;
    }

    .rotation-slot.tap-target {
        border-color: #4da6ff;
        box-shadow: 0 0 10px rgba(77, 166, 255, 0.45);
    }

    .skill-small,
    .rotation-slot,
    .remove-btn {
        touch-action: manipulation;
    }

    .team-slot .remove-btn {
        width: 22px;
        height: 22px;
        top: -6px;
        right: -6px;
        font-size: 13px;
        line-height: 1;
    }

    .rotation-skill:hover .remove-btn {
        opacity: 1;
    }

    .tooltip {
        display: none;
        opacity: 1;
        pointer-events: none;
    }

    .rotation-skill.tooltip-open .tooltip {
        display: block;
    }

    .arrow-effects {
        top: 12px;
        gap: 3px;
    }

    .arrow-effect-icon {
        width: 14px;
        height: 14px;
    }

    .team-slots {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 6px;
        width: 100%;
        align-items: stretch;
    }

    .team-slot {
        width: 100%;
        min-width: 0;
        aspect-ratio: 1 / 1;
        padding: 2px;
        box-sizing: border-box;
        position: relative;
        overflow: visible;
    }

    .team-slot img {
        width: 95%;
        height: 95%;
        display: block;
        border-radius: 10px;
    }

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

    .operator-card > img {
        width: 50px;
        height: 50px;
        border-radius: 15px;
    }

    .operator-card {
        width: 100%;
        height: 96px;
        border-radius: 14px;
        padding: 24px 5px 7px;
        box-sizing: border-box;
    }

    .rotation-slot.menu-open {
        border-color: #ffb347;
        box-shadow: 0 0 10px rgba(255, 179, 71, 0.45);
    }

    .slot-action-menu {
        position: absolute;
        left: 50%;
        top: 72px;
        transform: translateX(-50%);
        display: flex;
        gap: 6px;
        z-index: 80;
        background: rgba(15, 15, 15, 0.95);
        border: 1px solid #555;
        border-radius: 10px;
        padding: 6px;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    }

    .slot-action-btn {
        border: none;
        border-radius: 8px;
        background: #2a2a2a;
        color: white;
        padding: 8px 10px;
        font-size: 12px;
        line-height: 1;
        white-space: nowrap;
    }

    .slot-action-btn:disabled {
        opacity: 0.45;
    }

    .export-mode .remove-btn {
        display: none !important;
    }

    .export-mode .rotation-slot:empty {
        display: none !important;
    }

    .export-mode .rotation-slot {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .export-mode .rotation-arrow.is-unused {
        display: none !important;
    }

    #selectionScreen {
        display: none;
    }

    #selectionScreen.team-modal-open {
        position: fixed;
        inset: 0;
        z-index: 9998;
        overflow-y: auto;
        padding: 18px;
        background: rgba(8, 12, 14, 0.94);
        backdrop-filter: blur(8px);
        box-sizing: border-box;
    }

    #selectionScreen.team-modal-open .team-slots,
    #selectionScreen.team-modal-open .selection-title-row:first-of-type,
    #selectionScreen.team-modal-open .selection-max-label {
        display: none !important;
    }

    #selectionScreen.team-modal-open .operator-title-row {
        margin-top: 18px;
    }

    #selectionScreen.team-modal-open .selection-confirm-btn,
    #selectionScreen.team-modal-open .mobile-confirm-fab {
        position: fixed;
        right: 18px;
        bottom: calc(18px + env(safe-area-inset-bottom));
        z-index: 10000;
    }

    #selectionScreen.team-modal-open {
        padding-bottom: 110px;
    }

    #selectionScreen.team-modal-open .selection-hero,
    #selectionScreen.team-modal-open .selection-divider,
    #selectionScreen.team-modal-open .selection-title-row,
    #selectionScreen.team-modal-open .team-slots,
    #selectionScreen.team-modal-open .selection-confirm-btn,
    #selectionScreen.team-modal-open .mobile-confirm-fab {
        display: none !important;
    }

    #selectionScreen.team-modal-open .operator-title-row {
        margin-top: 0;
        margin-bottom: 18px;
    }

    #selectionScreen.team-modal-open .operator-title-row .selection-section-title {
        font-size: 28px;
    }

    #selectionScreen.team-modal-open {
        overflow-x: hidden;
        padding: 24px 12px 112px;
    }

    #selectionScreen.team-modal-open .operator-title-row,
    #selectionScreen.team-modal-open .operator-filter-panel,
    #selectionScreen.team-modal-open .operator-grid {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    #selectionScreen.team-modal-open .operator-title-row {
        padding: 16px 14px 10px;
    }

    #selectionScreen.team-modal-open .operator-filter-panel {
        overflow: hidden;
        padding: 0 14px 12px;
    }

    #selectionScreen.team-modal-open .operator-filter-top {
        gap: 8px;
    }

    #selectionScreen.team-modal-open .operator-search-wrap {
        min-width: 0;
    }

    #selectionScreen.team-modal-open .operator-search-input {
        min-width: 0;
    }

    #selectionScreen.team-modal-open .operator-filter-reset {
        flex: 0 0 auto;
        padding: 0 9px;
        font-size: 11px;
    }

    #selectionScreen.team-modal-open .operator-filter-buttons {
        flex-wrap: wrap;
        overflow-x: visible;
        gap: 5px;
        padding-bottom: 0;
    }

    #selectionScreen.team-modal-open .operator-filter-btn {
        min-height: 25px;
        padding: 0 8px;
        font-size: 10px;
    }

    #selectionScreen.team-modal-open .operator-filter-icon {
        width: 13px;
        height: 13px;
    }

    #selectionScreen.team-modal-open .operator-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
        overflow: visible;
        padding: 10px 14px 26px;
    }

    #selectionScreen.team-modal-open .operator-card {
        min-width: 0;
        height: 110px;
        padding: 25px 4px 8px;
    }

    #selectionScreen.team-modal-open .operator-card-meta {
        left: 5px;
        right: 5px;
        gap: 2px;
    }

    #selectionScreen.team-modal-open .operator-card-star {
        min-width: 22px;
        height: 16px;
        padding: 0 4px;
        font-size: 9px;
    }

    #selectionScreen.team-modal-open .operator-card-meta-icon {
        width: 15px;
        height: 15px;
    }

    #selectionScreen.team-modal-open .operator-card > img {
        width: 52px;
        height: 52px;
        border-radius: 10px;
    }

    #selectionScreen.team-modal-open .operator-name {
        max-width: 100%;
        font-size: 11px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .close-team-modal-btn {
        display: none;
    }

    #selectionScreen.team-modal-open .close-team-modal-btn,
    body.team-selection-modal-open .close-team-modal-btn {
        display: flex;
        position: fixed;

        top: auto;
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom));

        z-index: 10001;

        width: 62px;
        height: 62px;
        min-width: 62px;

        align-items: center;
        justify-content: center;

        border: none;
        border-radius: 50%;

        background: #F8F546;
        color: #111;

        font-size: 34px;
        font-weight: 700;
        line-height: 1;

        box-shadow:
            0 0 18px rgba(248, 245, 70, 0.42),
            0 7px 20px rgba(0, 0, 0, 0.45);

        backdrop-filter: blur(6px);
    }
}
